Trait chisel_stringtable::common::StringTable
source · pub trait StringTable<'a, Key: PartialOrd + Copy> {
// Required methods
fn add(&mut self, value: &str) -> Key;
fn remove(&mut self, key: Key);
fn get(&self, key: Key) -> Option<&Cow<'a, str>>;
fn len(&self) -> usize;
fn contains(&self, value: &str) -> Option<u64>;
fn hash(&self, value: &str) -> u64;
}
Expand description
Trait defining the basic operations required by a string table
Required Methods§
sourcefn add(&mut self, value: &str) -> Key
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.
sourcefn get(&self, key: Key) -> Option<&Cow<'a, str>>
fn get(&self, key: Key) -> Option<&Cow<'a, str>>
Attempts to retrieve a given value from the table.