Enum syntax::ext::tt::quoted::TokenTree
[−]
[src]
pub enum TokenTree {
Token(Span, Token),
Delimited(Span, Lrc<Delimited>),
Sequence(Span, Lrc<SequenceRepetition>),
MetaVar(Span, Ident),
MetaVarDecl(Span, Ident, Ident),
}Similar to tokenstream::TokenTree, except that $i, $i:ident, and $(...)
are "first-class" token trees. Useful for parsing macros.
Variants
Token(Span, Token)Delimited(Span, Lrc<Delimited>)Sequence(Span, Lrc<SequenceRepetition>)A kleene-style repetition sequence
MetaVar(Span, Ident)E.g. $var
MetaVarDecl(Span, Ident, Ident)E.g. $var:expr. This is only used in the left hand side of MBE macros.
Methods
impl TokenTree[src]
pub fn len(&self) -> usize[src]
Return the number of tokens in the tree.
pub fn is_empty(&self) -> bool[src]
Returns true if the given token tree contains no other tokens. This is vacuously true for single tokens or metavar/decls, but may be false for delimited trees or sequences.
pub fn get_tt(&self, index: usize) -> TokenTree[src]
Get the index-th sub-token-tree. This only makes sense for delimited trees and sequences.
pub fn span(&self) -> Span[src]
Retrieve the TokenTree's span.
Trait Implementations
impl Debug for TokenTree[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl Clone for TokenTree[src]
fn clone(&self) -> TokenTree[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl PartialEq for TokenTree[src]
fn eq(&self, __arg_0: &TokenTree) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &TokenTree) -> bool[src]
This method tests for !=.