pub struct Ident(/* private fields */);Expand description
An interned string identifier for efficient storage and comparison.
Identifiers are stored in a global string interner, allowing fast equality checks and reduced memory usage for frequently used strings.
Implementations§
Source§impl Ident
impl Ident
Sourcepub fn new(s: &str) -> Self
pub fn new(s: &str) -> Self
Creates a new interned identifier from a string slice.
If the string already exists in the interner, returns the existing identifier.
Sourcepub fn as_str(&self) -> String
pub fn as_str(&self) -> String
Resolves the identifier to its string representation.
Returns a new String with the identifier’s content.
Sourcepub fn resolve_with<F, R>(&self, f: F) -> R
pub fn resolve_with<F, R>(&self, f: F) -> R
Resolves the identifier and passes it to a callback function.
This is more efficient than as_str() when you don’t need to own the string,
as it avoids allocating a new String.
Trait Implementations§
Source§impl From<Ident> for RuntimeValue
impl From<Ident> for RuntimeValue
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
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 UnsafeUnpin 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§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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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