pub struct ParseMoreWrapper<T>(pub T);
Expand description
This wrapper implements syn::parse::Parse when T implements ParseMore. It permits to use this wrapper and a type implementing ParseMore in a parsing function from syn.
You should probably use parse_more(), parse_more_macro_input, or any other function from this crate instead of using this type directly.
§Example
use quote::quote;
use parse_more::ParseMoreWrapper;
use proc_macro::TokenStream;
use syn::{Ident, Token};
#[proc_macro]
pub fn flip_identifiers(input: TokenStream) -> TokenStream {
let (ident_a, arrow, ident_b) = syn::parse::<ParseMoreWrapper<(Ident, Token![=>], Ident)>>(input).unwrap().0;
quote! {
#ident_b <= #ident_a
}.into()
}
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<T: ParseMore> Parse for ParseMoreWrapper<T>
Call the ParseMore::parse method.
impl<T: ParseMore> Parse for ParseMoreWrapper<T>
Call the ParseMore::parse method.
fn parse(input: ParseStream<'_>) -> Result<Self>
Auto Trait Implementations§
impl<T> Freeze for ParseMoreWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for ParseMoreWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for ParseMoreWrapper<T>where
T: Send,
impl<T> Sync for ParseMoreWrapper<T>where
T: Sync,
impl<T> Unpin for ParseMoreWrapper<T>where
T: Unpin,
impl<T> UnwindSafe for ParseMoreWrapper<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more