pub struct StringInterner { /* private fields */ }Expand description
String interner — maps strings to compact IDs
Implementations§
Source§impl StringInterner
impl StringInterner
Sourcepub fn intern(&mut self, s: &str) -> InternedStr
pub fn intern(&mut self, s: &str) -> InternedStr
Intern a string, returning a deduplicated ID
Sourcepub fn get(&self, id: InternedStr) -> Option<&str>
pub fn get(&self, id: InternedStr) -> Option<&str>
Look up the string for a given ID
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Estimated memory usage in bytes
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