enum TokenTree {
    Token(Token),
    Delimited(DelimSpanDelimited),
    Sequence(DelimSpanSequenceRepetition),
    MetaVar(SpanIdent),
    MetaVarDecl(SpanIdentOption<NonterminalKind>),
    MetaVarExpr(DelimSpanMetaVarExpr),
}
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(DelimSpanDelimited)

A delimited sequence, e.g. ($e:expr) (RHS) or { $e } (LHS).

Sequence(DelimSpanSequenceRepetition)

A kleene-style repetition sequence, e.g. $($e:expr)* (RHS) or $($e),* (LHS).

MetaVar(SpanIdent)

e.g., $var.

MetaVarDecl(SpanIdentOption<NonterminalKind>)

e.g., $var:expr. Only appears on the LHS.

MetaVarExpr(DelimSpanMetaVarExpr)

A meta-variable expression inside ${...}.

Implementations

Returns true if the given token tree is delimited.

Returns true if the given token tree is a token of the given kind.

Retrieves the TokenTree’s span.

Trait Implementations

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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: 96 bytes

Size for each variant:

  • Token: 31 bytes
  • Delimited: 55 bytes
  • Sequence: 95 bytes
  • MetaVar: 23 bytes
  • MetaVarDecl: 23 bytes
  • MetaVarExpr: 55 bytes