Struct rustc_ast::token::Token [−][src]
Fields
kind: TokenKind
span: Span
Implementations
Recovers a Token
from an Ident
. This creates a raw identifier if necessary.
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, 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 a lifetime.
Returns true
if the token is an 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
Auto Trait Implementations
impl !RefUnwindSafe for Token
impl !UnwindSafe for Token
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: 24 bytes