pub trait StringTable<'a, Key: PartialOrd + Copy> {
    // Required methods
    fn add(&mut self, value: &str) -> Key;
    fn contains(&self, value: &str) -> bool;
    fn remove(&mut self, value: &str);
    fn get(&self, key: Key) -> Option<&Cow<'a, str>>;
    fn len(&self) -> usize;
}
Expand description

Trait defining the basic operations required by a string table

Required Methods§

source

fn add(&mut self, value: &str) -> Key

Add a new value to the string table. Returns the u32 hash value of the entry. If the entry already exists within the table, then this operation is idempotent, but the hash value is still returned.

source

fn contains(&self, value: &str) -> bool

Checks whether a given value is already stored within the table

source

fn remove(&mut self, value: &str)

Attempts to remove a given value from the table.

source

fn get(&self, key: Key) -> Option<&Cow<'a, str>>

Attempts to retrieve a given value from the table.

source

fn len(&self) -> usize

The number of elements currently within the table

Implementors§