pub struct StringInterner { /* private fields */ }Implementations§
Source§impl StringInterner
impl StringInterner
pub fn new() -> Self
pub fn with_capacity(string_capacity: usize, estimated_strings: usize) -> Self
pub fn intern(&mut self, s: &str) -> StrId
Sourcepub fn get_optional(&self, s: &str) -> Option<StrId>
pub fn get_optional(&self, s: &str) -> Option<StrId>
Look up a string in the dedup table without inserting.
Returns StrId if the string already exists, None otherwise.
pub fn lookup(&self, id: StrId) -> &str
Sourcepub fn get_hash(&self, id: StrId) -> u64
pub fn get_hash(&self, id: StrId) -> u64
Recompute the hash of an interned string on demand. The per-string hash is no longer stored (M4) — it is cheaply re-derived from the interned bytes with the same hasher, saving 8 bytes per unique string. Used to key the (separate) entity name table.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn total_bytes(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StringInterner
impl RefUnwindSafe for StringInterner
impl Send for StringInterner
impl Sync for StringInterner
impl Unpin for StringInterner
impl UnsafeUnpin for StringInterner
impl UnwindSafe for StringInterner
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