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

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

Fields

name: Symbolspan: Span

Methods

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 modern(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 "modern" macro (e.g., macro item, but not macro_rules item) and stay different if they came from different "modern" macros. Technically, this operation strips all non-opaque marks from ident's syntactic context.

pub fn modern_and_legacy(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]

impl Copy for Ident[src]

impl Debug for Ident[src]

impl Display for Ident[src]

impl Eq for Ident[src]

impl Hash for Ident[src]

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

impl PartialEq<Ident> for Ident[src]

impl StructuralEq for Ident[src]

impl UseSpecializedDecodable for Ident[src]

impl UseSpecializedEncodable 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]

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

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

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

impl<T> Decodable for T where
    T: UseSpecializedDecodable
[src]

impl<T> Encodable for T where
    T: UseSpecializedEncodable + ?Sized
[src]

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

impl<T> Erased for T[src]

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

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

impl<E> SpecializationError for E[src]

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

type Owned = T

The resulting type after obtaining ownership.

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

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.

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.