pub struct Ident {
    pub name: Symbol,
    pub span: Span,
}Expand description
An identifier.
Fields§
§name: SymbolThe identifier’s name.
span: SpanThe identifier’s span.
Implementations§
Source§impl Ident
 
impl Ident
Sourcepub const fn new(name: Symbol, span: Span) -> Ident
 
pub const fn new(name: Symbol, span: Span) -> Ident
Constructs a new identifier from a symbol and a span.
Sourcepub const fn with_dummy_span(name: Symbol) -> Ident
 
pub const fn with_dummy_span(name: Symbol) -> Ident
Constructs a new identifier with a dummy span.
Sourcepub fn from_str_and_span(string: &str, span: Span) -> Ident
 
pub fn from_str_and_span(string: &str, span: Span) -> Ident
Maps a string and a span to an identifier.
Sourcepub fn as_str(&self) -> &str
 
pub fn as_str(&self) -> &str
Access the underlying string.
Note that the lifetime of the return value is a lie. See Symbol::as_str() for details.
Sourcepub fn as_str_in(self, session: &Session) -> &str
 
pub fn as_str_in(self, session: &Session) -> &str
Access the underlying string in the given session.
The identifier must have been interned in the given session.
Sourcepub fn is_used_keyword(self) -> bool
 
pub fn is_used_keyword(self) -> bool
Returns true if the identifier is a keyword used in the language.
Sourcepub fn is_unused_keyword(self) -> bool
 
pub fn is_unused_keyword(self) -> bool
Returns true if the identifier is a keyword reserved for possible future use.
Sourcepub fn is_weak_keyword(self) -> bool
 
pub fn is_weak_keyword(self) -> bool
Returns true if the identifier is a weak keyword and can be used in variable names.
Sourcepub fn is_yul_keyword(self) -> bool
 
pub fn is_yul_keyword(self) -> bool
Returns true if the identifier is a keyword in a Yul context.
Sourcepub fn is_yul_evm_builtin(self) -> bool
 
pub fn is_yul_evm_builtin(self) -> bool
Returns true if the identifier is a Yul EVM builtin keyword.
Sourcepub fn is_reserved(self, yul: bool) -> bool
 
pub fn is_reserved(self, yul: bool) -> bool
Returns true if the identifier is either a keyword, either currently in use or reserved
for possible future use.
Sourcepub fn is_non_reserved(self, yul: bool) -> bool
 
pub fn is_non_reserved(self, yul: bool) -> bool
Returns true if the identifier is not a reserved keyword.
See is_reserved.
Sourcepub fn is_elementary_type(self) -> bool
 
pub fn is_elementary_type(self) -> bool
Returns true if the identifier is an elementary type name.
Note that this does not include [u]fixedMxN types.
Sourcepub fn is_bool_lit(self) -> bool
 
pub fn is_bool_lit(self) -> bool
Returns true if the identifier is true or false.
Sourcepub fn is_location_specifier(self) -> bool
 
pub fn is_location_specifier(self) -> bool
Returns true if the identifier is a location specifier.
Sourcepub fn is_mutability_specifier(self) -> bool
 
pub fn is_mutability_specifier(self) -> bool
Returns true if the identifier is a mutability specifier.
Sourcepub fn is_visibility_specifier(self) -> bool
 
pub fn is_visibility_specifier(self) -> bool
Returns true if the identifier is a visibility specifier.
Trait Implementations§
Source§impl FromIterator<Ident> for Path
 
impl FromIterator<Ident> for Path
Source§impl Ord for Ident
 
impl Ord for Ident
Source§impl PartialOrd for Ident
 
impl PartialOrd for Ident
impl Copy for Ident
impl Eq for Ident
Auto Trait Implementations§
impl Freeze for Ident
impl RefUnwindSafe for Ident
impl Send for Ident
impl Sync for Ident
impl Unpin for Ident
impl UnwindSafe for Ident
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T, R> CollectAndApply<T, R> for T
 
impl<T, R> CollectAndApply<T, R> for T
Source§impl<Q, K> Comparable<K> for Q
 
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
 
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
 
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more