Struct cov::intern::Interner [−][src]
pub struct Interner(_);
The string interner.
See the module documentation for detail.
Methods
impl Interner
[src]
impl Interner
pub fn new() -> Interner
[src]
pub fn new() -> Interner
Creates a new interner.
pub fn intern<S>(&mut self, s: S) -> Symbol where
S: Borrow<str>,
Box<str>: From<S>,
[src]
pub fn intern<S>(&mut self, s: S) -> Symbol where
S: Borrow<str>,
Box<str>: From<S>,
Inserts a string into the interner. Returns a Symbol
which can be use to extract the
original string.
ⓘImportant traits for Iter<'a>pub fn iter(&self) -> Iter
[src]
ⓘImportant traits for Iter<'a>
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
impl Debug for Interner
[src]
impl Debug for Interner
fn fmt(&self, fmt: &mut Formatter) -> Result
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Interner
[src]
impl Default for Interner
impl Index<Symbol> for Interner
[src]
impl Index<Symbol> for Interner