pub struct Interner { /* private fields */ }Expand description
String interner. Deduplicates strings and returns cheap Symbol handles.
Implementations§
Source§impl Interner
impl Interner
pub fn new() -> Interner
Sourcepub fn intern(&mut self, s: &str) -> Symbol
pub fn intern(&mut self, s: &str) -> Symbol
Intern a string, returning its Symbol. If the string was already interned, returns the existing Symbol.
Sourcepub fn intern_owned(&mut self, s: String) -> Symbol
pub fn intern_owned(&mut self, s: String) -> Symbol
Intern an owned string, avoiding clone if not already present.
Sourcepub fn try_resolve(&self, sym: Symbol) -> Option<&str>
pub fn try_resolve(&self, sym: Symbol) -> Option<&str>
Try to resolve a Symbol, returning None if invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interner
impl RefUnwindSafe for Interner
impl Send for Interner
impl Sync for Interner
impl Unpin for Interner
impl UnwindSafe for Interner
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