Skip to main content

TokenTree

Enum TokenTree 

Source
pub enum TokenTree {
    Ident(Ident),
    Keyword(Keyword),
    Punct(Punct),
    Literal(Lit),
    Group(Group),
}

Variants§

§

Ident(Ident)

§

Keyword(Keyword)

§

Punct(Punct)

§

Literal(Lit)

§

Group(Group)

Implementations§

Source§

impl TokenTree

Source

pub fn is_keyword(&self) -> bool

Source

pub fn as_keyword(&self) -> Option<&Keyword>

Source

pub fn is_keyword_as(&self) -> bool

As (“as”)

Source

pub fn as_keyword_as(&self) -> Option<&As>

As (“as”)

Source

pub fn is_keyword_async(&self) -> bool

Async (“async”)

Source

pub fn as_keyword_async(&self) -> Option<&Async>

Async (“async”)

Source

pub fn is_keyword_auto(&self) -> bool

Auto (“auto”)

Source

pub fn as_keyword_auto(&self) -> Option<&Auto>

Auto (“auto”)

Source

pub fn is_keyword_await(&self) -> bool

Await (“await”)

Source

pub fn as_keyword_await(&self) -> Option<&Await>

Await (“await”)

Source

pub fn is_keyword_become(&self) -> bool

Become (“become”)

Source

pub fn as_keyword_become(&self) -> Option<&Become>

Become (“become”)

Source

pub fn is_keyword_box(&self) -> bool

Box (“box”)

Source

pub fn as_keyword_box(&self) -> Option<&Box>

Box (“box”)

Source

pub fn is_keyword_break(&self) -> bool

Break (“break”)

Source

pub fn as_keyword_break(&self) -> Option<&Break>

Break (“break”)

Source

pub fn is_keyword_const(&self) -> bool

Const (“const”)

Source

pub fn as_keyword_const(&self) -> Option<&Const>

Const (“const”)

Source

pub fn is_keyword_continue(&self) -> bool

Continue (“continue”)

Source

pub fn as_keyword_continue(&self) -> Option<&Continue>

Continue (“continue”)

Source

pub fn is_keyword_crate(&self) -> bool

Crate (“crate”)

Source

pub fn as_keyword_crate(&self) -> Option<&Crate>

Crate (“crate”)

Source

pub fn is_keyword_default(&self) -> bool

Default (“default”)

Source

pub fn as_keyword_default(&self) -> Option<&Default>

Default (“default”)

Source

pub fn is_keyword_do(&self) -> bool

Do (“do”)

Source

pub fn as_keyword_do(&self) -> Option<&Do>

Do (“do”)

Source

pub fn is_keyword_dyn(&self) -> bool

Dyn (“dyn”)

Source

pub fn as_keyword_dyn(&self) -> Option<&Dyn>

Dyn (“dyn”)

Source

pub fn is_keyword_else(&self) -> bool

Else (“else”)

Source

pub fn as_keyword_else(&self) -> Option<&Else>

Else (“else”)

Source

pub fn is_keyword_enum(&self) -> bool

Enum (“enum”)

Source

pub fn as_keyword_enum(&self) -> Option<&Enum>

Enum (“enum”)

Source

pub fn is_keyword_extern(&self) -> bool

Extern (“extern”)

Source

pub fn as_keyword_extern(&self) -> Option<&Extern>

Extern (“extern”)

Source

pub fn is_keyword_final(&self) -> bool

Final (“final”)

Source

pub fn as_keyword_final(&self) -> Option<&Final>

Final (“final”)

Source

pub fn is_keyword_fn(&self) -> bool

Fn (“fn”)

Source

pub fn as_keyword_fn(&self) -> Option<&Fn>

Fn (“fn”)

Source

pub fn is_keyword_for(&self) -> bool

For (“for”)

Source

pub fn as_keyword_for(&self) -> Option<&For>

For (“for”)

Source

pub fn is_keyword_if(&self) -> bool

If (“if”)

Source

pub fn as_keyword_if(&self) -> Option<&If>

If (“if”)

Source

pub fn is_keyword_impl(&self) -> bool

Impl (“impl”)

Source

pub fn as_keyword_impl(&self) -> Option<&Impl>

Impl (“impl”)

Source

pub fn is_keyword_in(&self) -> bool

In (“in”)

Source

pub fn as_keyword_in(&self) -> Option<&In>

In (“in”)

Source

pub fn is_keyword_let(&self) -> bool

Let (“let”)

Source

pub fn as_keyword_let(&self) -> Option<&Let>

Let (“let”)

Source

pub fn is_keyword_loop(&self) -> bool

Loop (“loop”)

Source

pub fn as_keyword_loop(&self) -> Option<&Loop>

Loop (“loop”)

Source

pub fn is_keyword_macro(&self) -> bool

Macro (“macro”)

Source

pub fn as_keyword_macro(&self) -> Option<&Macro>

Macro (“macro”)

Source

pub fn is_keyword_macro_rules(&self) -> bool

MacroRules (“macro_rules”)

Source

pub fn as_keyword_macro_rules(&self) -> Option<&MacroRules>

MacroRules (“macro_rules”)

Source

pub fn is_keyword_match(&self) -> bool

Match (“match”)

Source

pub fn as_keyword_match(&self) -> Option<&Match>

Match (“match”)

Source

pub fn is_keyword_mod(&self) -> bool

Mod (“mod”)

Source

pub fn as_keyword_mod(&self) -> Option<&Mod>

Mod (“mod”)

Source

pub fn is_keyword_move(&self) -> bool

Move (“move”)

Source

pub fn as_keyword_move(&self) -> Option<&Move>

Move (“move”)

Source

pub fn is_keyword_mut(&self) -> bool

Mut (“mut”)

Source

pub fn as_keyword_mut(&self) -> Option<&Mut>

Mut (“mut”)

Source

pub fn is_keyword_override(&self) -> bool

Override (“override”)

Source

pub fn as_keyword_override(&self) -> Option<&Override>

Override (“override”)

Source

pub fn is_keyword_priv(&self) -> bool

Priv (“priv”)

Source

pub fn as_keyword_priv(&self) -> Option<&Priv>

Priv (“priv”)

Source

pub fn is_keyword_pub(&self) -> bool

Pub (“pub”)

Source

pub fn as_keyword_pub(&self) -> Option<&Pub>

Pub (“pub”)

Source

pub fn is_keyword_raw(&self) -> bool

Raw (“raw”)

Source

pub fn as_keyword_raw(&self) -> Option<&Raw>

Raw (“raw”)

Source

pub fn is_keyword_ref(&self) -> bool

Ref (“ref”)

Source

pub fn as_keyword_ref(&self) -> Option<&Ref>

Ref (“ref”)

Source

pub fn is_keyword_return(&self) -> bool

Return (“return”)

Source

pub fn as_keyword_return(&self) -> Option<&Return>

Return (“return”)

Source

pub fn is_keyword_self_type(&self) -> bool

SelfType (“Self”)

Source

pub fn as_keyword_self_type(&self) -> Option<&SelfType>

SelfType (“Self”)

Source

pub fn is_keyword_self_value(&self) -> bool

SelfValue (“self”)

Source

pub fn as_keyword_self_value(&self) -> Option<&SelfValue>

SelfValue (“self”)

Source

pub fn is_keyword_static(&self) -> bool

Static (“static”)

Source

pub fn as_keyword_static(&self) -> Option<&Static>

Static (“static”)

Source

pub fn is_keyword_struct(&self) -> bool

Struct (“struct”)

Source

pub fn as_keyword_struct(&self) -> Option<&Struct>

Struct (“struct”)

Source

pub fn is_keyword_super(&self) -> bool

Super (“super”)

Source

pub fn as_keyword_super(&self) -> Option<&Super>

Super (“super”)

Source

pub fn is_keyword_trait(&self) -> bool

Trait (“trait”)

Source

pub fn as_keyword_trait(&self) -> Option<&Trait>

Trait (“trait”)

Source

pub fn is_keyword_try(&self) -> bool

Try (“try”)

Source

pub fn as_keyword_try(&self) -> Option<&Try>

Try (“try”)

Source

pub fn is_keyword_type(&self) -> bool

Type (“type”)

Source

pub fn as_keyword_type(&self) -> Option<&Type>

Type (“type”)

Source

pub fn is_keyword_typeof(&self) -> bool

Typeof (“typeof”)

Source

pub fn as_keyword_typeof(&self) -> Option<&Typeof>

Typeof (“typeof”)

Source

pub fn is_keyword_union(&self) -> bool

Union (“union”)

Source

pub fn as_keyword_union(&self) -> Option<&Union>

Union (“union”)

Source

pub fn is_keyword_unsafe(&self) -> bool

Unsafe (“unsafe”)

Source

pub fn as_keyword_unsafe(&self) -> Option<&Unsafe>

Unsafe (“unsafe”)

Source

pub fn is_keyword_unsized(&self) -> bool

Unsized (“unsized”)

Source

pub fn as_keyword_unsized(&self) -> Option<&Unsized>

Unsized (“unsized”)

Source

pub fn is_keyword_use(&self) -> bool

Use (“use”)

Source

pub fn as_keyword_use(&self) -> Option<&Use>

Use (“use”)

Source

pub fn is_keyword_virtual(&self) -> bool

Virtual (“virtual”)

Source

pub fn as_keyword_virtual(&self) -> Option<&Virtual>

Virtual (“virtual”)

Source

pub fn is_keyword_where(&self) -> bool

Where (“where”)

Source

pub fn as_keyword_where(&self) -> Option<&Where>

Where (“where”)

Source

pub fn is_keyword_while(&self) -> bool

While (“while”)

Source

pub fn as_keyword_while(&self) -> Option<&While>

While (“while”)

Source

pub fn is_keyword_yield(&self) -> bool

Yield (“yield”)

Source

pub fn as_keyword_yield(&self) -> Option<&Yield>

Yield (“yield”)

Source§

impl TokenTree

Source

pub fn is_punct(&self) -> bool

Source

pub fn as_punct(&self) -> Option<&Punct>

Source

pub fn is_punct_and(&self) -> bool

And (“&”)

Source

pub fn as_punct_and(&self) -> Option<&And>

And (“&”)

Source

pub fn is_punct_or(&self) -> bool

Or (“|”)

Source

pub fn as_punct_or(&self) -> Option<&Or>

Or (“|”)

Source

pub fn is_punct_not(&self) -> bool

Not (“!”)

Source

pub fn as_punct_not(&self) -> Option<&Not>

Not (“!”)

Source

pub fn is_punct_tilde(&self) -> bool

Tilde (“~”)

Source

pub fn as_punct_tilde(&self) -> Option<&Tilde>

Tilde (“~”)

Source

pub fn is_punct_plus(&self) -> bool

Plus (“+”)

Source

pub fn as_punct_plus(&self) -> Option<&Plus>

Plus (“+”)

Source

pub fn is_punct_minus(&self) -> bool

Minus (“-”)

Source

pub fn as_punct_minus(&self) -> Option<&Minus>

Minus (“-”)

Source

pub fn is_punct_underscore(&self) -> bool

Underscore (“_”)

Source

pub fn as_punct_underscore(&self) -> Option<&Underscore>

Underscore (“_”)

Source

pub fn is_punct_star(&self) -> bool

Star (“*”)

Source

pub fn as_punct_star(&self) -> Option<&Star>

Star (“*”)

Source

pub fn is_punct_slash(&self) -> bool

Slash (“/”)

Source

pub fn as_punct_slash(&self) -> Option<&Slash>

Slash (“/”)

Source

pub fn is_punct_percent(&self) -> bool

Percent (“%”)

Source

pub fn as_punct_percent(&self) -> Option<&Percent>

Percent (“%”)

Source

pub fn is_punct_caret(&self) -> bool

Caret (“^”)

Source

pub fn as_punct_caret(&self) -> Option<&Caret>

Caret (“^”)

Source

pub fn is_punct_eq(&self) -> bool

Eq (“=”)

Source

pub fn as_punct_eq(&self) -> Option<&Eq>

Eq (“=”)

Source

pub fn is_punct_lt(&self) -> bool

Lt (“<”)

Source

pub fn as_punct_lt(&self) -> Option<&Lt>

Lt (“<”)

Source

pub fn is_punct_gt(&self) -> bool

Gt (“>”)

Source

pub fn as_punct_gt(&self) -> Option<&Gt>

Gt (“>”)

Source

pub fn is_punct_at(&self) -> bool

At (“@”)

Source

pub fn as_punct_at(&self) -> Option<&At>

At (“@”)

Source

pub fn is_punct_dot(&self) -> bool

Dot (“.”)

Source

pub fn as_punct_dot(&self) -> Option<&Dot>

Dot (“.”)

Source

pub fn is_punct_comma(&self) -> bool

Comma (“,”)

Source

pub fn as_punct_comma(&self) -> Option<&Comma>

Comma (“,”)

Source

pub fn is_punct_semi(&self) -> bool

Semi (“;”)

Source

pub fn as_punct_semi(&self) -> Option<&Semi>

Semi (“;”)

Source

pub fn is_punct_colon(&self) -> bool

Colon (“:”)

Source

pub fn as_punct_colon(&self) -> Option<&Colon>

Colon (“:”)

Source

pub fn is_punct_pound(&self) -> bool

Pound (“#”)

Source

pub fn as_punct_pound(&self) -> Option<&Pound>

Pound (“#”)

Source

pub fn is_punct_dollar(&self) -> bool

Dollar (“$”)

Source

pub fn as_punct_dollar(&self) -> Option<&Dollar>

Dollar (“$”)

Source

pub fn is_punct_question(&self) -> bool

Question (“?”)

Source

pub fn as_punct_question(&self) -> Option<&Question>

Question (“?”)

Source

pub fn is_punct_quote(&self) -> bool

Quote (“’”)

Source

pub fn as_punct_quote(&self) -> Option<&Quote>

Quote (“’”)

Source§

impl TokenTree

Source

pub fn span(&self) -> Span

Source

pub fn text(&self) -> Option<&str>

Source

pub fn delim(&self) -> Option<Delim>

Source

pub fn is_token(&self) -> bool

Source

pub fn is_group(&self) -> bool

Source

pub fn as_group(&self) -> Option<&Group>

Source

pub fn is_ident(&self) -> bool

Source

pub fn as_ident(&self) -> Option<&Ident>

Source

pub fn is_literal(&self) -> bool

Source

pub fn as_literal(&self) -> Option<&Lit>

Trait Implementations§

Source§

impl Clone for TokenTree

Source§

fn clone(&self) -> TokenTree

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TokenTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TokenTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TokenTree

Source§

impl Extend<TokenTree> for TokenStream

Source§

fn extend<T: IntoIterator<Item = TokenTree>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<Group> for TokenTree

Source§

fn from(value: Group) -> Self

Converts to this type from the input type.
Source§

impl From<Ident> for TokenTree

Source§

fn from(value: Ident) -> Self

Converts to this type from the input type.
Source§

impl From<Keyword> for TokenTree

Source§

fn from(value: Keyword) -> Self

Converts to this type from the input type.
Source§

impl From<Lit> for TokenTree

Source§

fn from(value: Lit) -> Self

Converts to this type from the input type.
Source§

impl From<Punct> for TokenTree

Source§

fn from(value: Punct) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<TokenTree> for TokenStream

Source§

fn from_iter<T: IntoIterator<Item = TokenTree>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl IntoIterator for TokenTree

Source§

type Item = TokenTree

The type of the elements being iterated over.
Source§

type IntoIter = Once<TokenTree>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for TokenTree

Source§

fn eq(&self, other: &TokenTree) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Spanner for TokenTree

Source§

fn span(&self) -> Span

Source§

impl StructuralPartialEq for TokenTree

Source§

impl ToTokens for TokenTree

Source§

fn to_tokens(&self, tokens: &mut TokenStream)

Source§

impl ToTokens<TokenStream> for TokenTree

Source§

fn to_tokens(&self, out: &mut TokenStream)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<X> ToTokenStream for X
where X: ToTokens + ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.