pub struct LabelInterner { /* private fields */ }Expand description
Label-text interner. Same shape, separate index space, with slot 0 pre-seeded as the empty string.
Implementations§
Source§impl LabelInterner
impl LabelInterner
pub fn new() -> Self
pub fn intern(&mut self, text: &str) -> LabelId
Sourcepub fn resolve(&self, ix: LabelId) -> &str
pub fn resolve(&self, ix: LabelId) -> &str
Resolve an index back to its label text.
§Panics
Panics if ix did not come from this interner’s intern. Indices
are dense and append-only within one LabelInterner instance; they
are not portable across instances, and an out-of-range index panics
rather than silently returning a wrong or empty string.
Trait Implementations§
Source§impl Debug for LabelInterner
impl Debug for LabelInterner
Auto Trait Implementations§
impl Freeze for LabelInterner
impl RefUnwindSafe for LabelInterner
impl Send for LabelInterner
impl Sync for LabelInterner
impl Unpin for LabelInterner
impl UnsafeUnpin for LabelInterner
impl UnwindSafe for LabelInterner
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