Trait proc_macro_utils::TokenTreeExt
source · pub trait TokenTreeExt {
type Group;
type Ident;
type Punct;
type Literal;
// Required methods
fn is_group(&self) -> bool;
fn group(self) -> Option<<Self as TokenTreeExt>::Group>;
fn is_ident(&self) -> bool;
fn ident(self) -> Option<<Self as TokenTreeExt>::Ident>;
fn is_punct(&self) -> bool;
fn punct(self) -> Option<<Self as TokenTreeExt>::Punct>;
fn is_literal(&self) -> bool;
fn literal(self) -> Option<<Self as TokenTreeExt>::Literal>;
}
Expand description
Generic extensions for
proc_macro::TokenTree
and
proc_macro2::TokenTree
Required Associated Types§
Required Methods§
sourcefn group(self) -> Option<<Self as TokenTreeExt>::Group>
fn group(self) -> Option<<Self as TokenTreeExt>::Group>
Get the Group
inside this token tree, or None
if it isn’t a group.
sourcefn ident(self) -> Option<<Self as TokenTreeExt>::Ident>
fn ident(self) -> Option<<Self as TokenTreeExt>::Ident>
Get the Ident
inside this token tree, or None
if it isn’t an ident.
sourcefn punct(self) -> Option<<Self as TokenTreeExt>::Punct>
fn punct(self) -> Option<<Self as TokenTreeExt>::Punct>
Get the Punct
inside this token tree, or None
if it isn’t a punctuation.
sourcefn is_literal(&self) -> bool
fn is_literal(&self) -> bool
Tests if the token tree is a literal.