pub enum TokenTree {
Ident(Ident),
Keyword(Keyword),
Punct(Punct),
Literal(Lit),
Group(Group),
}Expand description
One Rust token: a group, identifier, literal, punctuation mark, or keyword.
Variants§
Implementations§
Source§impl TokenTree
impl TokenTree
pub fn is_keyword(&self) -> bool
pub fn as_keyword(&self) -> Option<&Keyword>
Sourcepub fn is_keyword_as(&self) -> bool
pub fn is_keyword_as(&self) -> bool
As (“as”)
Sourcepub fn as_keyword_as(&self) -> Option<&As>
pub fn as_keyword_as(&self) -> Option<&As>
As (“as”)
Sourcepub fn is_keyword_async(&self) -> bool
pub fn is_keyword_async(&self) -> bool
Async (“async”)
Sourcepub fn as_keyword_async(&self) -> Option<&Async>
pub fn as_keyword_async(&self) -> Option<&Async>
Async (“async”)
Sourcepub fn is_keyword_auto(&self) -> bool
pub fn is_keyword_auto(&self) -> bool
Auto (“auto”)
Sourcepub fn as_keyword_auto(&self) -> Option<&Auto>
pub fn as_keyword_auto(&self) -> Option<&Auto>
Auto (“auto”)
Sourcepub fn is_keyword_await(&self) -> bool
pub fn is_keyword_await(&self) -> bool
Await (“await”)
Sourcepub fn as_keyword_await(&self) -> Option<&Await>
pub fn as_keyword_await(&self) -> Option<&Await>
Await (“await”)
Sourcepub fn is_keyword_become(&self) -> bool
pub fn is_keyword_become(&self) -> bool
Become (“become”)
Sourcepub fn as_keyword_become(&self) -> Option<&Become>
pub fn as_keyword_become(&self) -> Option<&Become>
Become (“become”)
Sourcepub fn is_keyword_box(&self) -> bool
pub fn is_keyword_box(&self) -> bool
Box (“box”)
Sourcepub fn as_keyword_box(&self) -> Option<&Box>
pub fn as_keyword_box(&self) -> Option<&Box>
Box (“box”)
Sourcepub fn is_keyword_break(&self) -> bool
pub fn is_keyword_break(&self) -> bool
Break (“break”)
Sourcepub fn as_keyword_break(&self) -> Option<&Break>
pub fn as_keyword_break(&self) -> Option<&Break>
Break (“break”)
Sourcepub fn is_keyword_const(&self) -> bool
pub fn is_keyword_const(&self) -> bool
Const (“const”)
Sourcepub fn as_keyword_const(&self) -> Option<&Const>
pub fn as_keyword_const(&self) -> Option<&Const>
Const (“const”)
Sourcepub fn is_keyword_continue(&self) -> bool
pub fn is_keyword_continue(&self) -> bool
Continue (“continue”)
Sourcepub fn as_keyword_continue(&self) -> Option<&Continue>
pub fn as_keyword_continue(&self) -> Option<&Continue>
Continue (“continue”)
Sourcepub fn is_keyword_crate(&self) -> bool
pub fn is_keyword_crate(&self) -> bool
Crate (“crate”)
Sourcepub fn as_keyword_crate(&self) -> Option<&Crate>
pub fn as_keyword_crate(&self) -> Option<&Crate>
Crate (“crate”)
Sourcepub fn is_keyword_default(&self) -> bool
pub fn is_keyword_default(&self) -> bool
Default (“default”)
Sourcepub fn as_keyword_default(&self) -> Option<&Default>
pub fn as_keyword_default(&self) -> Option<&Default>
Default (“default”)
Sourcepub fn is_keyword_do(&self) -> bool
pub fn is_keyword_do(&self) -> bool
Do (“do”)
Sourcepub fn as_keyword_do(&self) -> Option<&Do>
pub fn as_keyword_do(&self) -> Option<&Do>
Do (“do”)
Sourcepub fn is_keyword_dyn(&self) -> bool
pub fn is_keyword_dyn(&self) -> bool
Dyn (“dyn”)
Sourcepub fn as_keyword_dyn(&self) -> Option<&Dyn>
pub fn as_keyword_dyn(&self) -> Option<&Dyn>
Dyn (“dyn”)
Sourcepub fn is_keyword_else(&self) -> bool
pub fn is_keyword_else(&self) -> bool
Else (“else”)
Sourcepub fn as_keyword_else(&self) -> Option<&Else>
pub fn as_keyword_else(&self) -> Option<&Else>
Else (“else”)
Sourcepub fn is_keyword_enum(&self) -> bool
pub fn is_keyword_enum(&self) -> bool
Enum (“enum”)
Sourcepub fn as_keyword_enum(&self) -> Option<&Enum>
pub fn as_keyword_enum(&self) -> Option<&Enum>
Enum (“enum”)
Sourcepub fn is_keyword_extern(&self) -> bool
pub fn is_keyword_extern(&self) -> bool
Extern (“extern”)
Sourcepub fn as_keyword_extern(&self) -> Option<&Extern>
pub fn as_keyword_extern(&self) -> Option<&Extern>
Extern (“extern”)
Sourcepub fn is_keyword_final(&self) -> bool
pub fn is_keyword_final(&self) -> bool
Final (“final”)
Sourcepub fn as_keyword_final(&self) -> Option<&Final>
pub fn as_keyword_final(&self) -> Option<&Final>
Final (“final”)
Sourcepub fn is_keyword_fn(&self) -> bool
pub fn is_keyword_fn(&self) -> bool
Fn (“fn”)
Sourcepub fn as_keyword_fn(&self) -> Option<&Fn>
pub fn as_keyword_fn(&self) -> Option<&Fn>
Fn (“fn”)
Sourcepub fn is_keyword_for(&self) -> bool
pub fn is_keyword_for(&self) -> bool
For (“for”)
Sourcepub fn as_keyword_for(&self) -> Option<&For>
pub fn as_keyword_for(&self) -> Option<&For>
For (“for”)
Sourcepub fn is_keyword_if(&self) -> bool
pub fn is_keyword_if(&self) -> bool
If (“if”)
Sourcepub fn as_keyword_if(&self) -> Option<&If>
pub fn as_keyword_if(&self) -> Option<&If>
If (“if”)
Sourcepub fn is_keyword_impl(&self) -> bool
pub fn is_keyword_impl(&self) -> bool
Impl (“impl”)
Sourcepub fn as_keyword_impl(&self) -> Option<&Impl>
pub fn as_keyword_impl(&self) -> Option<&Impl>
Impl (“impl”)
Sourcepub fn is_keyword_in(&self) -> bool
pub fn is_keyword_in(&self) -> bool
In (“in”)
Sourcepub fn as_keyword_in(&self) -> Option<&In>
pub fn as_keyword_in(&self) -> Option<&In>
In (“in”)
Sourcepub fn is_keyword_let(&self) -> bool
pub fn is_keyword_let(&self) -> bool
Let (“let”)
Sourcepub fn as_keyword_let(&self) -> Option<&Let>
pub fn as_keyword_let(&self) -> Option<&Let>
Let (“let”)
Sourcepub fn is_keyword_loop(&self) -> bool
pub fn is_keyword_loop(&self) -> bool
Loop (“loop”)
Sourcepub fn as_keyword_loop(&self) -> Option<&Loop>
pub fn as_keyword_loop(&self) -> Option<&Loop>
Loop (“loop”)
Sourcepub fn is_keyword_macro(&self) -> bool
pub fn is_keyword_macro(&self) -> bool
Macro (“macro”)
Sourcepub fn as_keyword_macro(&self) -> Option<&Macro>
pub fn as_keyword_macro(&self) -> Option<&Macro>
Macro (“macro”)
Sourcepub fn is_keyword_macro_rules(&self) -> bool
pub fn is_keyword_macro_rules(&self) -> bool
MacroRules (“macro_rules”)
Sourcepub fn as_keyword_macro_rules(&self) -> Option<&MacroRules>
pub fn as_keyword_macro_rules(&self) -> Option<&MacroRules>
MacroRules (“macro_rules”)
Sourcepub fn is_keyword_match(&self) -> bool
pub fn is_keyword_match(&self) -> bool
Match (“match”)
Sourcepub fn as_keyword_match(&self) -> Option<&Match>
pub fn as_keyword_match(&self) -> Option<&Match>
Match (“match”)
Sourcepub fn is_keyword_mod(&self) -> bool
pub fn is_keyword_mod(&self) -> bool
Mod (“mod”)
Sourcepub fn as_keyword_mod(&self) -> Option<&Mod>
pub fn as_keyword_mod(&self) -> Option<&Mod>
Mod (“mod”)
Sourcepub fn is_keyword_move(&self) -> bool
pub fn is_keyword_move(&self) -> bool
Move (“move”)
Sourcepub fn as_keyword_move(&self) -> Option<&Move>
pub fn as_keyword_move(&self) -> Option<&Move>
Move (“move”)
Sourcepub fn is_keyword_mut(&self) -> bool
pub fn is_keyword_mut(&self) -> bool
Mut (“mut”)
Sourcepub fn as_keyword_mut(&self) -> Option<&Mut>
pub fn as_keyword_mut(&self) -> Option<&Mut>
Mut (“mut”)
Sourcepub fn is_keyword_override(&self) -> bool
pub fn is_keyword_override(&self) -> bool
Override (“override”)
Sourcepub fn as_keyword_override(&self) -> Option<&Override>
pub fn as_keyword_override(&self) -> Option<&Override>
Override (“override”)
Sourcepub fn is_keyword_priv(&self) -> bool
pub fn is_keyword_priv(&self) -> bool
Priv (“priv”)
Sourcepub fn as_keyword_priv(&self) -> Option<&Priv>
pub fn as_keyword_priv(&self) -> Option<&Priv>
Priv (“priv”)
Sourcepub fn is_keyword_pub(&self) -> bool
pub fn is_keyword_pub(&self) -> bool
Pub (“pub”)
Sourcepub fn as_keyword_pub(&self) -> Option<&Pub>
pub fn as_keyword_pub(&self) -> Option<&Pub>
Pub (“pub”)
Sourcepub fn is_keyword_raw(&self) -> bool
pub fn is_keyword_raw(&self) -> bool
Raw (“raw”)
Sourcepub fn as_keyword_raw(&self) -> Option<&Raw>
pub fn as_keyword_raw(&self) -> Option<&Raw>
Raw (“raw”)
Sourcepub fn is_keyword_ref(&self) -> bool
pub fn is_keyword_ref(&self) -> bool
Ref (“ref”)
Sourcepub fn as_keyword_ref(&self) -> Option<&Ref>
pub fn as_keyword_ref(&self) -> Option<&Ref>
Ref (“ref”)
Sourcepub fn is_keyword_return(&self) -> bool
pub fn is_keyword_return(&self) -> bool
Return (“return”)
Sourcepub fn as_keyword_return(&self) -> Option<&Return>
pub fn as_keyword_return(&self) -> Option<&Return>
Return (“return”)
Sourcepub fn is_keyword_self_type(&self) -> bool
pub fn is_keyword_self_type(&self) -> bool
SelfType (“Self”)
Sourcepub fn as_keyword_self_type(&self) -> Option<&SelfType>
pub fn as_keyword_self_type(&self) -> Option<&SelfType>
SelfType (“Self”)
Sourcepub fn is_keyword_self_value(&self) -> bool
pub fn is_keyword_self_value(&self) -> bool
SelfValue (“self”)
Sourcepub fn as_keyword_self_value(&self) -> Option<&SelfValue>
pub fn as_keyword_self_value(&self) -> Option<&SelfValue>
SelfValue (“self”)
Sourcepub fn is_keyword_static(&self) -> bool
pub fn is_keyword_static(&self) -> bool
Static (“static”)
Sourcepub fn as_keyword_static(&self) -> Option<&Static>
pub fn as_keyword_static(&self) -> Option<&Static>
Static (“static”)
Sourcepub fn is_keyword_struct(&self) -> bool
pub fn is_keyword_struct(&self) -> bool
Struct (“struct”)
Sourcepub fn as_keyword_struct(&self) -> Option<&Struct>
pub fn as_keyword_struct(&self) -> Option<&Struct>
Struct (“struct”)
Sourcepub fn is_keyword_super(&self) -> bool
pub fn is_keyword_super(&self) -> bool
Super (“super”)
Sourcepub fn as_keyword_super(&self) -> Option<&Super>
pub fn as_keyword_super(&self) -> Option<&Super>
Super (“super”)
Sourcepub fn is_keyword_trait(&self) -> bool
pub fn is_keyword_trait(&self) -> bool
Trait (“trait”)
Sourcepub fn as_keyword_trait(&self) -> Option<&Trait>
pub fn as_keyword_trait(&self) -> Option<&Trait>
Trait (“trait”)
Sourcepub fn is_keyword_try(&self) -> bool
pub fn is_keyword_try(&self) -> bool
Try (“try”)
Sourcepub fn as_keyword_try(&self) -> Option<&Try>
pub fn as_keyword_try(&self) -> Option<&Try>
Try (“try”)
Sourcepub fn is_keyword_type(&self) -> bool
pub fn is_keyword_type(&self) -> bool
Type (“type”)
Sourcepub fn as_keyword_type(&self) -> Option<&Type>
pub fn as_keyword_type(&self) -> Option<&Type>
Type (“type”)
Sourcepub fn is_keyword_typeof(&self) -> bool
pub fn is_keyword_typeof(&self) -> bool
Typeof (“typeof”)
Sourcepub fn as_keyword_typeof(&self) -> Option<&Typeof>
pub fn as_keyword_typeof(&self) -> Option<&Typeof>
Typeof (“typeof”)
Sourcepub fn is_keyword_union(&self) -> bool
pub fn is_keyword_union(&self) -> bool
Union (“union”)
Sourcepub fn as_keyword_union(&self) -> Option<&Union>
pub fn as_keyword_union(&self) -> Option<&Union>
Union (“union”)
Sourcepub fn is_keyword_unsafe(&self) -> bool
pub fn is_keyword_unsafe(&self) -> bool
Unsafe (“unsafe”)
Sourcepub fn as_keyword_unsafe(&self) -> Option<&Unsafe>
pub fn as_keyword_unsafe(&self) -> Option<&Unsafe>
Unsafe (“unsafe”)
Sourcepub fn is_keyword_unsized(&self) -> bool
pub fn is_keyword_unsized(&self) -> bool
Unsized (“unsized”)
Sourcepub fn as_keyword_unsized(&self) -> Option<&Unsized>
pub fn as_keyword_unsized(&self) -> Option<&Unsized>
Unsized (“unsized”)
Sourcepub fn is_keyword_use(&self) -> bool
pub fn is_keyword_use(&self) -> bool
Use (“use”)
Sourcepub fn as_keyword_use(&self) -> Option<&Use>
pub fn as_keyword_use(&self) -> Option<&Use>
Use (“use”)
Sourcepub fn is_keyword_virtual(&self) -> bool
pub fn is_keyword_virtual(&self) -> bool
Virtual (“virtual”)
Sourcepub fn as_keyword_virtual(&self) -> Option<&Virtual>
pub fn as_keyword_virtual(&self) -> Option<&Virtual>
Virtual (“virtual”)
Sourcepub fn is_keyword_where(&self) -> bool
pub fn is_keyword_where(&self) -> bool
Where (“where”)
Sourcepub fn as_keyword_where(&self) -> Option<&Where>
pub fn as_keyword_where(&self) -> Option<&Where>
Where (“where”)
Sourcepub fn is_keyword_while(&self) -> bool
pub fn is_keyword_while(&self) -> bool
While (“while”)
Sourcepub fn as_keyword_while(&self) -> Option<&While>
pub fn as_keyword_while(&self) -> Option<&While>
While (“while”)
Sourcepub fn is_keyword_yield(&self) -> bool
pub fn is_keyword_yield(&self) -> bool
Yield (“yield”)
Sourcepub fn as_keyword_yield(&self) -> Option<&Yield>
pub fn as_keyword_yield(&self) -> Option<&Yield>
Yield (“yield”)
Source§impl TokenTree
impl TokenTree
pub fn is_punct(&self) -> bool
pub fn as_punct(&self) -> Option<&Punct>
Sourcepub fn is_punct_and(&self) -> bool
pub fn is_punct_and(&self) -> bool
And (“&”)
Sourcepub fn as_punct_and(&self) -> Option<&And>
pub fn as_punct_and(&self) -> Option<&And>
And (“&”)
Sourcepub fn is_punct_or(&self) -> bool
pub fn is_punct_or(&self) -> bool
Or (“|”)
Sourcepub fn as_punct_or(&self) -> Option<&Or>
pub fn as_punct_or(&self) -> Option<&Or>
Or (“|”)
Sourcepub fn is_punct_not(&self) -> bool
pub fn is_punct_not(&self) -> bool
Not (“!”)
Sourcepub fn as_punct_not(&self) -> Option<&Not>
pub fn as_punct_not(&self) -> Option<&Not>
Not (“!”)
Sourcepub fn is_punct_tilde(&self) -> bool
pub fn is_punct_tilde(&self) -> bool
Tilde (“~”)
Sourcepub fn as_punct_tilde(&self) -> Option<&Tilde>
pub fn as_punct_tilde(&self) -> Option<&Tilde>
Tilde (“~”)
Sourcepub fn is_punct_plus(&self) -> bool
pub fn is_punct_plus(&self) -> bool
Plus (“+”)
Sourcepub fn as_punct_plus(&self) -> Option<&Plus>
pub fn as_punct_plus(&self) -> Option<&Plus>
Plus (“+”)
Sourcepub fn is_punct_minus(&self) -> bool
pub fn is_punct_minus(&self) -> bool
Minus (“-”)
Sourcepub fn as_punct_minus(&self) -> Option<&Minus>
pub fn as_punct_minus(&self) -> Option<&Minus>
Minus (“-”)
Sourcepub fn is_punct_underscore(&self) -> bool
pub fn is_punct_underscore(&self) -> bool
Underscore (“_”)
Sourcepub fn as_punct_underscore(&self) -> Option<&Underscore>
pub fn as_punct_underscore(&self) -> Option<&Underscore>
Underscore (“_”)
Sourcepub fn is_punct_star(&self) -> bool
pub fn is_punct_star(&self) -> bool
Star (“*”)
Sourcepub fn as_punct_star(&self) -> Option<&Star>
pub fn as_punct_star(&self) -> Option<&Star>
Star (“*”)
Sourcepub fn is_punct_slash(&self) -> bool
pub fn is_punct_slash(&self) -> bool
Slash (“/”)
Sourcepub fn as_punct_slash(&self) -> Option<&Slash>
pub fn as_punct_slash(&self) -> Option<&Slash>
Slash (“/”)
Sourcepub fn is_punct_percent(&self) -> bool
pub fn is_punct_percent(&self) -> bool
Percent (“%”)
Sourcepub fn as_punct_percent(&self) -> Option<&Percent>
pub fn as_punct_percent(&self) -> Option<&Percent>
Percent (“%”)
Sourcepub fn is_punct_caret(&self) -> bool
pub fn is_punct_caret(&self) -> bool
Caret (“^”)
Sourcepub fn as_punct_caret(&self) -> Option<&Caret>
pub fn as_punct_caret(&self) -> Option<&Caret>
Caret (“^”)
Sourcepub fn is_punct_eq(&self) -> bool
pub fn is_punct_eq(&self) -> bool
Eq (“=”)
Sourcepub fn as_punct_eq(&self) -> Option<&Eq>
pub fn as_punct_eq(&self) -> Option<&Eq>
Eq (“=”)
Sourcepub fn is_punct_lt(&self) -> bool
pub fn is_punct_lt(&self) -> bool
Lt (“<”)
Sourcepub fn as_punct_lt(&self) -> Option<&Lt>
pub fn as_punct_lt(&self) -> Option<&Lt>
Lt (“<”)
Sourcepub fn is_punct_gt(&self) -> bool
pub fn is_punct_gt(&self) -> bool
Gt (“>”)
Sourcepub fn as_punct_gt(&self) -> Option<&Gt>
pub fn as_punct_gt(&self) -> Option<&Gt>
Gt (“>”)
Sourcepub fn is_punct_at(&self) -> bool
pub fn is_punct_at(&self) -> bool
At (“@”)
Sourcepub fn as_punct_at(&self) -> Option<&At>
pub fn as_punct_at(&self) -> Option<&At>
At (“@”)
Sourcepub fn is_punct_dot(&self) -> bool
pub fn is_punct_dot(&self) -> bool
Dot (“.”)
Sourcepub fn as_punct_dot(&self) -> Option<&Dot>
pub fn as_punct_dot(&self) -> Option<&Dot>
Dot (“.”)
Sourcepub fn is_punct_comma(&self) -> bool
pub fn is_punct_comma(&self) -> bool
Comma (“,”)
Sourcepub fn as_punct_comma(&self) -> Option<&Comma>
pub fn as_punct_comma(&self) -> Option<&Comma>
Comma (“,”)
Sourcepub fn is_punct_semi(&self) -> bool
pub fn is_punct_semi(&self) -> bool
Semi (“;”)
Sourcepub fn as_punct_semi(&self) -> Option<&Semi>
pub fn as_punct_semi(&self) -> Option<&Semi>
Semi (“;”)
Sourcepub fn is_punct_colon(&self) -> bool
pub fn is_punct_colon(&self) -> bool
Colon (“:”)
Sourcepub fn as_punct_colon(&self) -> Option<&Colon>
pub fn as_punct_colon(&self) -> Option<&Colon>
Colon (“:”)
Sourcepub fn is_punct_pound(&self) -> bool
pub fn is_punct_pound(&self) -> bool
Pound (“#”)
Sourcepub fn as_punct_pound(&self) -> Option<&Pound>
pub fn as_punct_pound(&self) -> Option<&Pound>
Pound (“#”)
Sourcepub fn is_punct_dollar(&self) -> bool
pub fn is_punct_dollar(&self) -> bool
Dollar (“$”)
Sourcepub fn as_punct_dollar(&self) -> Option<&Dollar>
pub fn as_punct_dollar(&self) -> Option<&Dollar>
Dollar (“$”)
Sourcepub fn is_punct_question(&self) -> bool
pub fn is_punct_question(&self) -> bool
Question (“?”)
Sourcepub fn as_punct_question(&self) -> Option<&Question>
pub fn as_punct_question(&self) -> Option<&Question>
Question (“?”)
Sourcepub fn is_punct_quote(&self) -> bool
pub fn is_punct_quote(&self) -> bool
Quote (“’”)
Sourcepub fn as_punct_quote(&self) -> Option<&Quote>
pub fn as_punct_quote(&self) -> Option<&Quote>
Quote (“’”)
Source§impl TokenTree
impl TokenTree
pub fn span(&self) -> Span
pub fn text(&self) -> Option<&str>
pub fn delim(&self) -> Option<Delim>
pub fn is_token(&self) -> bool
pub fn is_group(&self) -> bool
pub fn as_group(&self) -> Option<&Group>
pub fn is_ident(&self) -> bool
pub fn as_ident(&self) -> Option<&Ident>
pub fn is_literal(&self) -> bool
pub fn as_literal(&self) -> Option<&Lit>
Trait Implementations§
impl Eq for TokenTree
Source§impl Extend<TokenTree> for TokenStream
impl Extend<TokenTree> for TokenStream
Source§fn extend<T: IntoIterator<Item = TokenTree>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = TokenTree>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)