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
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::Groups with Delimiter::None delimiters and negative
numeric literals.
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::Groups with Delimiter::None delimiters and negative
numeric literals.
Source§impl Extend<TokenTree> for TokenStream
impl Extend<TokenTree> for TokenStream
Source§fn extend<I>(&mut self, streams: I)where
I: IntoIterator<Item = TokenTree>,
fn extend<I>(&mut self, streams: I)where
I: IntoIterator<Item = TokenTree>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl From<TokenTree> for TokenStream
impl From<TokenTree> for TokenStream
Source§fn from(token: TokenTree) -> TokenStream
fn from(token: TokenTree) -> TokenStream
Source§impl FromIterator<TokenTree> for TokenStream
Collects a number of token trees into a single stream.
impl FromIterator<TokenTree> for TokenStream
Collects a number of token trees into a single stream.
Source§fn from_iter<I>(streams: I) -> TokenStreamwhere
I: IntoIterator<Item = TokenTree>,
fn from_iter<I>(streams: I) -> TokenStreamwhere
I: IntoIterator<Item = TokenTree>,
Source§impl ToTokens for TokenTree
impl ToTokens for TokenTree
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl Token for TokenTree
Auto Trait Implementations§
impl Freeze for TokenTree
impl RefUnwindSafe for TokenTree
impl !Send for TokenTree
impl !Sync for TokenTree
impl Unpin for TokenTree
impl UnwindSafe for TokenTree
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes
Size for each variant:
Group: 28 bytesIdent: 28 bytesPunct: 12 bytesLiteral: 28 bytes