pub struct Symbol(/* private fields */);Expand description
An interned string.
Internally, a Symbol is implemented as an index, and all operations
(including hashing, equality, and ordering) operate on that index.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn with<F: FnOnce(&str) -> R, R>(self, f: F) -> R
pub fn with<F: FnOnce(&str) -> R, R>(self, f: F) -> R
Access the symbol’s chars. This is a slowish operation because it requires locking the symbol interner.
Sourcepub fn as_str(self) -> SymbolStr
pub fn as_str(self) -> SymbolStr
Convert to a SymbolStr. This is a slowish operation because it
requires locking the symbol interner.
pub const fn as_u32(self) -> u32
Trait Implementations§
Source§impl Ord for Symbol
impl Ord for Symbol
Source§impl PartialOrd for Symbol
impl PartialOrd for Symbol
impl Copy for Symbol
impl Eq for Symbol
impl StructuralPartialEq for Symbol
Auto Trait Implementations§
impl Freeze for Symbol
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
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> 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.