Struct rustc_ap_rustc_span::symbol::Ident[][src]

pub struct Ident {
    pub name: Symbol,
    pub span: Span,
}

Fields

name: Symbolspan: Span

Implementations

Constructs a new identifier from a symbol and a span.

Constructs a new identifier with a dummy span.

Maps a string to an identifier with a dummy span.

Maps a string and a span to an identifier.

Replaces lo and hi with those from span, but keep hygiene context.

“Normalize” ident for use in comparisons using “item hygiene”. Identifiers with same string value become same if they came from the same macro 2.0 macro (e.g., macro item, but not macro_rules item) and stay different if they came from different macro 2.0 macros. Technically, this operation strips all non-opaque marks from ident’s syntactic context.

“Normalize” ident for use in comparisons using “local variable hygiene”. Identifiers with same string value become same if they came from the same non-transparent macro (e.g., macro or macro_rules! items) and stay different if they came from different non-transparent macros. Technically, this operation strips all transparent marks from ident’s syntactic context.

Convert the name to a SymbolStr. This is a slowish operation because it requires locking the symbol interner.

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.

A keyword or reserved identifier that can be used as a path segment.

We see this identifier in a normal identifier position, like variable name or a type. How was it written originally? Did it use the raw form? Let’s try to guess.

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 implementation is supposed to be used in error messages, so it’s expected to be identical to printing the original identifier token written in source code (token_to_string), except that AST identifiers don’t keep the rawness flag, so we have to guess it.

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. 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

Compare self to key and return true if they are equal.

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

Converts the given value to a String. 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.