pub struct Symbol(/* private fields */);Expand description
A lightweight handle to an interned string.
Symbols are Copy and compare in O(1) time regardless of string length.
Use Interner::resolve to retrieve the original string.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn index(self) -> usize
pub fn index(self) -> usize
Returns the internal index of this symbol.
Useful for dense storage (e.g., indexing into a Vec instead of a HashMap).
Sourcepub fn from_index(i: usize) -> Symbol
pub fn from_index(i: usize) -> Symbol
Reconstructs a symbol from an internal index — the inverse of
Symbol::index. Sound only for an index produced by index() on a
symbol from the same interner (the bounds prover round-trips symbols
through their dense indices as LinearExpr variable ids).
Trait Implementations§
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 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