Struct rustc_ap_rustc_ast::token::Token[][src]

pub struct Token {
    pub kind: TokenKind,
    pub span: Span,
}

Fields

kind: TokenKindspan: Span

Implementations

Some token that will be thrown away later.

Recovers a Token from an Ident. This creates a raw identifier if necessary.

Return this token by value and leave a dummy token in its place.

For interpolated tokens, returns a span of the fragment to which the interpolated token refers. For all other tokens this is just a regular span. It is particularly important to use this for identifiers and lifetimes for which spans affect name resolution and edition checks. Note that keywords are also identifiers, so they should use this if they keep spans or perform edition checks.

Returns true if the token can appear at the start of an expression.

Returns true if the token can appear at the start of a type.

Returns true if the token can appear at the start of a const param.

Returns true if the token can appear at the start of a generic bound.

Returns true if the token is any literal.

Returns true if the token is any literal, a minus (which can prefix a literal, for example a ‘-42’, or one of the boolean idents).

In other words, would this token be a valid start of parse_literal_maybe_minus?

Keep this in sync with and Lit::from_token, excluding unary negation.

Returns an identifier if this token is an identifier.

Returns a lifetime identifier if this token is a lifetime.

Returns true if the token is an identifier.

Returns true if the token is a lifetime.

Returns true if the token is a identifier whose name is the given string slice.

Would maybe_whole_expr in parser.rs return Ok(..)? That is, is this a pre-parsed expression dropped into the token stream (which happens while parsing the result of macro expansion)?

Returns true if the token is either the mut or const keyword.

Returns true if the token is a given keyword, kw.

Returns true if the token is a keyword used in the language.

Returns true if the token is a keyword reserved for possible future use.

Returns true if the token is either a special identifier or a keyword.

Returns true if the token is the identifier true or false.

Returns true if the token is a non-raw identifier for which pred holds.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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 !=.

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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.