Struct boomphf::hashmap::BoomHashMap2
source · pub struct BoomHashMap2<K: Hash, D1, D2> { /* private fields */ }
Expand description
A HashMap data structure where the mapping between keys and 2 values is encoded in a Mphf. You should usually use BoomHashMap
with a tuple/struct value type.
If the layout overhead of the struct / tuple must be avoided, this variant of is an alternative.
This lets us store the keys and values in dense
arrays, with ~3 bits/item overhead in the Mphf.
Implementations§
source§impl<K, D1, D2> BoomHashMap2<K, D1, D2>where
K: Hash + Debug + PartialEq,
D1: Debug,
D2: Debug,
impl<K, D1, D2> BoomHashMap2<K, D1, D2>where K: Hash + Debug + PartialEq, D1: Debug, D2: Debug,
sourcepub fn new(
keys: Vec<K>,
values: Vec<D1>,
aux_values: Vec<D2>
) -> BoomHashMap2<K, D1, D2>
pub fn new( keys: Vec<K>, values: Vec<D1>, aux_values: Vec<D2> ) -> BoomHashMap2<K, D1, D2>
Create a new hash map from the parallel arrays keys
and values
, and aux_values
pub fn get<Q>(&self, kmer: &Q) -> Option<(&D1, &D2)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
pub fn get_mut<Q>(&mut self, kmer: &Q) -> Option<(&mut D1, &mut D2)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
pub fn get_key_id<Q>(&self, kmer: &Q) -> Option<usize>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> Boom2Iterator<'_, K, D1, D2> ⓘ
pub fn get_key(&self, id: usize) -> Option<&K>
source§impl<K, D1, D2> BoomHashMap2<K, D1, D2>where
K: Hash + Debug + PartialEq + Send + Sync,
D1: Debug,
D2: Debug,
impl<K, D1, D2> BoomHashMap2<K, D1, D2>where K: Hash + Debug + PartialEq + Send + Sync, D1: Debug, D2: Debug,
sourcepub fn new_parallel(
keys: Vec<K>,
data: Vec<D1>,
aux_data: Vec<D2>
) -> BoomHashMap2<K, D1, D2>
pub fn new_parallel( keys: Vec<K>, data: Vec<D1>, aux_data: Vec<D2> ) -> BoomHashMap2<K, D1, D2>
Create a new hash map from the parallel arrays keys
and values
, and aux_values
, using a parallel algorithm to construct the Mphf.
Trait Implementations§
source§impl<K: Clone + Hash, D1: Clone, D2: Clone> Clone for BoomHashMap2<K, D1, D2>
impl<K: Clone + Hash, D1: Clone, D2: Clone> Clone for BoomHashMap2<K, D1, D2>
source§fn clone(&self) -> BoomHashMap2<K, D1, D2>
fn clone(&self) -> BoomHashMap2<K, D1, D2>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<K, D1, D2> FromIterator<(K, D1, D2)> for BoomHashMap2<K, D1, D2>where
K: Hash + Debug + PartialEq,
D1: Debug,
D2: Debug,
impl<K, D1, D2> FromIterator<(K, D1, D2)> for BoomHashMap2<K, D1, D2>where K: Hash + Debug + PartialEq, D1: Debug, D2: Debug,
source§fn from_iter<I: IntoIterator<Item = (K, D1, D2)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (K, D1, D2)>>(iter: I) -> Self
Creates a value from an iterator. Read more
source§impl<'a, K: Hash, D1, D2> IntoIterator for &'a BoomHashMap2<K, D1, D2>
impl<'a, K: Hash, D1, D2> IntoIterator for &'a BoomHashMap2<K, D1, D2>
Auto Trait Implementations§
impl<K, D1, D2> RefUnwindSafe for BoomHashMap2<K, D1, D2>where D1: RefUnwindSafe, D2: RefUnwindSafe, K: RefUnwindSafe,
impl<K, D1, D2> Send for BoomHashMap2<K, D1, D2>where D1: Send, D2: Send, K: Send,
impl<K, D1, D2> Sync for BoomHashMap2<K, D1, D2>where D1: Sync, D2: Sync, K: Sync,
impl<K, D1, D2> Unpin for BoomHashMap2<K, D1, D2>where D1: Unpin, D2: Unpin, K: Unpin,
impl<K, D1, D2> UnwindSafe for BoomHashMap2<K, D1, D2>where D1: UnwindSafe, D2: UnwindSafe, K: UnwindSafe,
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