pub struct Ident { /* private fields */ }Expand description
An identifier in the source code.
Implementations§
Source§impl Ident
impl Ident
pub fn unspanned(text: impl Into<AstString>) -> Self
Sourcepub fn new(text: impl Into<AstString>, span: Span) -> Self
pub fn new(text: impl Into<AstString>, span: Span) -> Self
Create an identifier from a string.
This accepts keywords without errors.
Using the From<Keyword> implementation does the same thing,
but more explicitly.
§Panics
If the characters are not valid, this will panic.
pub fn is_keyword(&self) -> bool
pub fn to_keyword(&self) -> Option<Keyword>
pub fn to_short_type_spec(&self) -> Option<ShortTypeSpec>
Trait Implementations§
Source§impl AsRef<Ident> for GlobalName
impl AsRef<Ident> for GlobalName
Source§impl AsRef<Ident> for TemporaryName
impl AsRef<Ident> for TemporaryName
Source§impl Borrow<Ident> for GlobalName
impl Borrow<Ident> for GlobalName
Source§impl Borrow<Ident> for TemporaryName
impl Borrow<Ident> for TemporaryName
Source§impl Comparable<Ident> for BlockName
impl Comparable<Ident> for BlockName
Source§impl Comparable<Ident> for GlobalName
impl Comparable<Ident> for GlobalName
Source§impl Comparable<Ident> for TemporaryName
impl Comparable<Ident> for TemporaryName
Source§impl Comparable<Ident> for TypeName
impl Comparable<Ident> for TypeName
Source§impl Comparable<String> for Ident
impl Comparable<String> for Ident
Source§impl Equivalent<Ident> for BlockName
impl Equivalent<Ident> for BlockName
Source§fn equivalent(&self, other: &Ident) -> bool
fn equivalent(&self, other: &Ident) -> bool
Compare self to
key and return true if they are equal.Source§impl Equivalent<Ident> for GlobalName
impl Equivalent<Ident> for GlobalName
Source§fn equivalent(&self, other: &Ident) -> bool
fn equivalent(&self, other: &Ident) -> bool
Compare self to
key and return true if they are equal.Source§impl Equivalent<Ident> for TemporaryName
impl Equivalent<Ident> for TemporaryName
Source§fn equivalent(&self, other: &Ident) -> bool
fn equivalent(&self, other: &Ident) -> bool
Compare self to
key and return true if they are equal.Source§impl Equivalent<Ident> for TypeName
impl Equivalent<Ident> for TypeName
Source§fn equivalent(&self, other: &Ident) -> bool
fn equivalent(&self, other: &Ident) -> bool
Compare self to
key and return true if they are equal.Source§impl Equivalent<String> for Ident
impl Equivalent<String> for Ident
Source§fn equivalent(&self, other: &String) -> bool
fn equivalent(&self, other: &String) -> bool
Compare self to
key and return true if they are equal.Source§impl Ord for Ident
impl Ord for Ident
Source§impl PartialOrd for Ident
impl PartialOrd for Ident
impl Eq for Ident
impl StructuralPartialEq 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.