Skip to main content

BoomHashMap2

Struct 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,

Source

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

Source

pub fn get<Q>(&self, kmer: &Q) -> Option<(&D1, &D2)>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn get_mut<Q>(&mut self, kmer: &Q) -> Option<(&mut D1, &mut D2)>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn get_key_id<Q>(&self, kmer: &Q) -> Option<usize>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> Boom2Iterator<'_, K, D1, D2>

Source

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,

Source

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>

Source§

fn clone(&self) -> BoomHashMap2<K, D1, D2>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Debug + Hash, D1: Debug, D2: Debug> Debug for BoomHashMap2<K, D1, D2>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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

Creates a value from an iterator. Read more
Source§

impl<'a, K: Hash, D1, D2> IntoIterator for &'a BoomHashMap2<K, D1, D2>

Source§

type Item = (&'a K, &'a D1, &'a D2)

The type of the elements being iterated over.
Source§

type IntoIter = Boom2Iterator<'a, K, D1, D2>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Boom2Iterator<'a, K, D1, D2>

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<K, D1, D2> Freeze for BoomHashMap2<K, D1, D2>

§

impl<K, D1, D2> RefUnwindSafe for BoomHashMap2<K, D1, D2>

§

impl<K, D1, D2> Send for BoomHashMap2<K, D1, D2>
where K: Send, D1: Send, D2: Send,

§

impl<K, D1, D2> Sync for BoomHashMap2<K, D1, D2>
where K: Sync, D1: Sync, D2: Sync,

§

impl<K, D1, D2> Unpin for BoomHashMap2<K, D1, D2>
where K: Unpin, D1: Unpin, D2: Unpin,

§

impl<K, D1, D2> UnsafeUnpin for BoomHashMap2<K, D1, D2>

§

impl<K, D1, D2> UnwindSafe for BoomHashMap2<K, D1, D2>
where K: UnwindSafe, D1: UnwindSafe, D2: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.