pub struct Interner(/* private fields */);Expand description
The string interner.
See the module documentation for detail.
Implementations§
Source§impl Interner
impl Interner
Sourcepub fn intern<S>(&mut self, s: S) -> Symbol
pub fn intern<S>(&mut self, s: S) -> Symbol
Inserts a string into the interner. Returns a Symbol which can be use to extract the
original string.
Sourcepub fn iter(&self) -> Iter<'_> ⓘ
pub fn iter(&self) -> Iter<'_> ⓘ
Iterates the content of the interner.
§Examples
use cov::Interner;
let mut interner = Interner::new();
let s1 = interner.intern("one");
let s2 = interner.intern("two");
let s3 = interner.intern("three");
let iter_res = interner.iter().collect::<Vec<_>>();
assert_eq!(iter_res, vec![
(s1, "one"),
(s2, "two"),
(s3, "three"),
]);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