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

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

Fields

name: Symbolspan: Span

Implementations

impl Ident[src]

pub const fn new(name: Symbol, span: Span) -> Ident[src]

Constructs a new identifier from a symbol and a span.

pub const fn with_dummy_span(name: Symbol) -> Ident[src]

Constructs a new identifier with a dummy span.

pub fn invalid() -> Ident[src]

pub fn from_str(string: &str) -> Ident[src]

Maps a string to an identifier with a dummy span.

pub fn from_str_and_span(string: &str, span: Span) -> Ident[src]

Maps a string and a span to an identifier.

pub fn with_span_pos(self, span: Span) -> Ident[src]

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

pub fn without_first_quote(self) -> Ident[src]

pub fn normalize_to_macros_2_0(self) -> Ident[src]

“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.

pub fn normalize_to_macro_rules(self) -> Ident[src]

“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.

pub fn as_str(self) -> SymbolStr[src]

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

impl Ident[src]

pub fn is_special(self) -> bool[src]

pub fn is_used_keyword(self) -> bool[src]

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

pub fn is_unused_keyword(self) -> bool[src]

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

pub fn is_reserved(self) -> bool[src]

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

pub fn is_path_segment_keyword(self) -> bool[src]

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

pub fn is_raw_guess(self) -> bool[src]

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

impl Clone for Ident[src]

fn clone(&self) -> Ident[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Ident[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<__D: Decoder> Decodable<__D> for Ident[src]

fn decode(__decoder: &mut __D) -> Result<Self, <__D as Decoder>::Error>[src]

impl Display for Ident[src]

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.

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<__E: Encoder> Encodable<__E> for Ident[src]

fn encode(&self, __encoder: &mut __E) -> Result<(), <__E as Encoder>::Error>[src]

impl Hash for Ident[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

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

impl<__CTX> HashStable<__CTX> for Ident where
    __CTX: HashStableContext
[src]

fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)[src]

impl PartialEq<Ident> for Ident[src]

fn eq(&self, rhs: &Self) -> bool[src]

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

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Copy for Ident[src]

impl Eq for Ident[src]

impl StructuralEq for Ident[src]

Auto Trait Implementations

impl RefUnwindSafe for Ident

impl !Send for Ident

impl !Sync for Ident

impl Unpin for Ident

impl UnwindSafe for Ident

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

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

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

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

fn in_current_span(self) -> Instrumented<Self>[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]