Enum proc_macro::TokenTree
1.29.0 · source · pub enum TokenTree {
Group(Group),
Ident(Ident),
Punct(Punct),
Literal(Literal),
}
Expand description
A single token or a delimited sequence of token trees (e.g., [1, (), ..]
).
Variants§
Group(Group)
A token stream surrounded by bracket delimiters.
Ident(Ident)
An identifier.
Punct(Punct)
A single punctuation character (+
, ,
, $
, etc.).
Literal(Literal)
A literal character ('a'
), string ("hello"
), number (2.3
), etc.
Implementations§
Trait Implementations§
source§impl Display for TokenTree
impl Display for TokenTree
Prints the token tree as a string that is supposed to be losslessly convertible back
into the same token tree (modulo spans), except for possibly TokenTree::Group
s
with Delimiter::None
delimiters and negative numeric literals.
1.30.0 · source§impl Extend<TokenTree> for TokenStream
impl Extend<TokenTree> for TokenStream
source§fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, trees: I)
fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, trees: I)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
#72631)Extends a collection with exactly one element.
source§impl From<TokenTree> for TokenStream
impl From<TokenTree> for TokenStream
Creates a token stream containing a single token tree.
source§fn from(tree: TokenTree) -> TokenStream
fn from(tree: TokenTree) -> TokenStream
Converts to this type from the input type.
source§impl FromIterator<TokenTree> for TokenStream
impl FromIterator<TokenTree> for TokenStream
Collects a number of token trees into a single stream.