SHARE
TWEET

Untitled

a guest Jul 17th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #![allow(unused_variables)]
  2. #![allow(unused_must_use)]
  3.  
  4. use syn::{parse_str, parenthesized, Lit};
  5. use syn::parse::{Parse, ParseStream, Result};
  6.  
  7. #[derive(Debug)] struct A {}
  8.  
  9. impl Parse for A {
  10.     fn parse(input: ParseStream) -> Result<A> {
  11.         let content;
  12.         parenthesized!(content in input);
  13.         content.parse::<Lit>()?;
  14.         Ok(A {})
  15.     }
  16. }
  17.  
  18. fn main() {
  19.     let x = parse_str::<A>("(1)");
  20.     dbg!(x);
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top