Enum rustc_expand::mbe::TokenTree
source · enum TokenTree {
Token(Token),
Delimited(DelimSpan, Delimited),
Sequence(DelimSpan, SequenceRepetition),
MetaVar(Span, Ident),
MetaVarDecl(Span, Ident, Option<NonterminalKind>),
MetaVarExpr(DelimSpan, MetaVarExpr),
}
Expand description
Similar to tokenstream::TokenTree
, except that Sequence
, MetaVar
, MetaVarDecl
, and
MetaVarExpr
are “first-class” token trees. Useful for parsing macros.
Variants§
Token(Token)
Delimited(DelimSpan, Delimited)
A delimited sequence, e.g. ($e:expr)
(RHS) or { $e }
(LHS).
Sequence(DelimSpan, SequenceRepetition)
A kleene-style repetition sequence, e.g. $($e:expr)*
(RHS) or $($e),*
(LHS).
MetaVar(Span, Ident)
e.g., $var
.
MetaVarDecl(Span, Ident, Option<NonterminalKind>)
e.g., $var:expr
. Only appears on the LHS.
MetaVarExpr(DelimSpan, MetaVarExpr)
A meta-variable expression inside ${...}
.
Implementations§
Trait Implementations§
impl StructuralPartialEq for TokenTree
Auto Trait Implementations§
impl !RefUnwindSafe for TokenTree
impl !Send for TokenTree
impl !Sync for TokenTree
impl Unpin for TokenTree
impl !UnwindSafe for TokenTree
Blanket Implementations§
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: 88 bytes
Size for each variant:
Token
: 24 bytesDelimited
: 48 bytesSequence
: 88 bytesMetaVar
: 20 bytesMetaVarDecl
: 24 bytesMetaVarExpr
: 48 bytes