Enum rustc_expand::mbe::TokenTree [−][src]
enum TokenTree {
Token(Token),
Delimited(DelimSpan, Lrc<Delimited>),
Sequence(DelimSpan, Lrc<SequenceRepetition>),
MetaVar(Span, Ident),
MetaVarDecl(Span, Ident, Option<NonterminalKind>),
}
Expand description
Similar to tokenstream::TokenTree
, except that $i
, $i:ident
, and $(...)
are “first-class” token trees. Useful for parsing macros.
Variants
Token(Token)
Tuple Fields of Token
0: Token
Sequence(DelimSpan, Lrc<SequenceRepetition>)
A kleene-style repetition sequence
Tuple Fields of Sequence
0: DelimSpan
1: Lrc<SequenceRepetition>
e.g., $var
MetaVarDecl(Span, Ident, Option<NonterminalKind>)
e.g., $var:expr
. This is only used in the left hand side of MBE macros.
Tuple Fields of MetaVarDecl
Implementations
Returns true
if the given token tree is delimited.
Returns true
if the given token tree is a token of the given kind.
Gets the index
-th sub-token-tree. This only makes sense for delimited trees and sequences.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for TokenTree
impl !UnwindSafe for TokenTree
Blanket Implementations
Mutably borrows from an owned value. Read more
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:
Token
: 31 bytesDelimited
: 31 bytesSequence
: 31 bytesMetaVar
: 23 bytesMetaVarDecl
: 23 bytes