[−][src]Function call2_for_syn::call2
pub fn call2<T, P: FnMut(ParseStream) -> T>(input: TokenStream, parser: P) -> T
Analogous to syn::parse2
and syn::parse::ParseBuffer::call
.
Example
use { call2_for_syn::call2, quote::quote, syn::{Ident, Token}, }; let (hello, world) = call2::<syn::Result<_>, _>(quote!(Hello world!), |input| { let hello: Ident = input.parse()?; let world: Ident = input.parse()?; input.parse::<Token![!]>()?; Ok((hello, world)) })?; assert_eq!(format!("{}", hello), "Hello"); assert_eq!(format!("{}", world), "world");