pub struct Symbol(/* private fields */);Expand description
An interned identifier.
A Symbol is a four-byte Copy index into one Interner. Equality is an
integer comparison rather than a string comparison, which is what keeps name
resolution cheap when every expression carries a name.
A Symbol is deliberately not serializable. The index means nothing
without the interner that produced it, so a serialized one would be a number
that reads like a name. Code that must persist an identifier persists the
text.
Implementations§
Trait Implementations§
impl Copy for Symbol
impl Eq for Symbol
Source§impl Ord for Symbol
impl Ord for Symbol
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Symbol
impl PartialOrd for Symbol
impl StructuralPartialEq for Symbol
Auto Trait Implementations§
impl Forget for Symbol
impl Freeze for Symbol
impl Move for Symbol
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnsafeUnpin 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