Struct boomphf::hashmap::NoKeyBoomHashMap
source · pub struct NoKeyBoomHashMap<K, D1> {
pub mphf: Mphf<K>,
pub values: Vec<D1>,
}
Expand description
A HashMap data structure where the mapping between keys and values is encoded in a Mphf. Keys are not stored - this can greatly improve the memory consumption, but can only be used if you can guarantee that you will only query for keys that were in the original set. Querying for a new key will return a random value, silently.
Fields§
§mphf: Mphf<K>
§values: Vec<D1>
Implementations§
source§impl<K, D1> NoKeyBoomHashMap<K, D1>where
K: ConstructibleKey,
D1: Debug,
impl<K, D1> NoKeyBoomHashMap<K, D1>where K: ConstructibleKey, D1: Debug,
sourcepub fn new(keys: Vec<K>, data: Vec<D1>) -> NoKeyBoomHashMap<K, D1>
pub fn new(keys: Vec<K>, data: Vec<D1>) -> NoKeyBoomHashMap<K, D1>
Create a new hash map from the parallel array keys
and values
serially using only this thread.
sourcepub fn new_parallel(keys: Vec<K>, values: Vec<D1>) -> NoKeyBoomHashMap<K, D1>
pub fn new_parallel(keys: Vec<K>, values: Vec<D1>) -> NoKeyBoomHashMap<K, D1>
Create a new hash map from the parallel array keys
and values
.
pub fn new_with_mphf(mphf: Mphf<K>, values: Vec<D1>) -> NoKeyBoomHashMap<K, D1>
sourcepub fn get<Q>(&self, kmer: &Q) -> Option<&D1>where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get<Q>(&self, kmer: &Q) -> Option<&D1>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Get the value associated with key
. You must use a key that was supplied during the creation of the BoomHashMap. Querying for a new key will yield Some
with a random value, or None
. Querying with a valid key will always return Some
.
sourcepub fn get_mut<Q>(&mut self, kmer: &Q) -> Option<&mut D1>where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get_mut<Q>(&mut self, kmer: &Q) -> Option<&mut D1>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Mutably get the value associated with key
. You must use a key that was supplied during the creation of the BoomHashMap. Querying for a new key will yield Some
with a random value, or None
. Querying with a valid key will always return Some
.
Trait Implementations§
source§impl<K: Clone, D1: Clone> Clone for NoKeyBoomHashMap<K, D1>
impl<K: Clone, D1: Clone> Clone for NoKeyBoomHashMap<K, D1>
source§fn clone(&self) -> NoKeyBoomHashMap<K, D1>
fn clone(&self) -> NoKeyBoomHashMap<K, D1>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more