Enum syntax::tokenstream::TokenTree[][src]

pub enum TokenTree {
    Token(SpanToken),
    Delimited(SpanDelimited),
}

When the main rust parser encounters a syntax-extension invocation, it parses the arguments to the invocation as a token-tree. This is a very loose structure, such that all sorts of different AST-fragments can be passed to syntax extensions using a uniform type.

If the syntax extension is an MBE macro, it will attempt to match its LHS token tree against the provided token tree, and if it finds a match, will transcribe the RHS token tree, splicing in any captured macro_parser::matched_nonterminals into the SubstNts it finds.

The RHS of an MBE macro is the only place SubstNts are substituted. Nothing special happens to misnamed or misplaced SubstNts.

Variants

A single token

A delimited sequence of token trees

Methods

impl TokenTree
[src]

Use this token tree as a matcher to parse given tts.

Check if this TokenTree is equal to the other, regardless of span information.

Retrieve the TokenTree's span.

Modify the TokenTree's span inplace.

Indicates if the stream is a token that is equal to the provided token.

Trait Implementations

impl Debug for TokenTree
[src]

Formats the value using the given formatter. Read more

impl Clone for TokenTree
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for TokenTree
[src]

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

This method tests for !=.

impl Eq for TokenTree
[src]

impl Encodable for TokenTree
[src]

impl Decodable for TokenTree
[src]

impl Hash for TokenTree
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl From<TokenTree> for TokenStream
[src]

Performs the conversion.

impl ToTokens for TokenTree
[src]

Important traits for Vec<u8>

Auto Trait Implementations

impl !Send for TokenTree

impl !Sync for TokenTree