pub struct HammingHasher<const B: usize, const H: usize> { /* private fields */ }
Expand description
This structure allows one to generate balanced locality-sensitive hashes.
B
is the number of bytes in the codewords.
H
is the number of bytes in the hash.
Implementations§
Source§impl<const B: usize, const H: usize> HammingHasher<B, H>
impl<const B: usize, const H: usize> HammingHasher<B, H>
pub fn new() -> Self
pub fn new_with_seed(seed: u64) -> Self
Sourcepub fn new_with_codewords(codewords: Vec<BitArray<B>>) -> Self
pub fn new_with_codewords(codewords: Vec<BitArray<B>>) -> Self
There must be exactly H * 8
codewords.
Sourcepub fn hash(&self, feature: &BitArray<B>) -> BitArray<H>
pub fn hash(&self, feature: &BitArray<B>) -> BitArray<H>
Convert the input feature into a hash.
Sourcepub fn hash_bag<'a>(
&self,
features: impl IntoIterator<Item = &'a BitArray<B>>,
) -> BitArray<H>
pub fn hash_bag<'a>( &self, features: impl IntoIterator<Item = &'a BitArray<B>>, ) -> BitArray<H>
Convert the input features into a hash.
Trait Implementations§
Source§impl<const B: usize, const H: usize> Clone for HammingHasher<B, H>
impl<const B: usize, const H: usize> Clone for HammingHasher<B, H>
Source§fn clone(&self) -> HammingHasher<B, H>
fn clone(&self) -> HammingHasher<B, H>
Returns a duplicate 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 moreAuto Trait Implementations§
impl<const B: usize, const H: usize> Freeze for HammingHasher<B, H>
impl<const B: usize, const H: usize> RefUnwindSafe for HammingHasher<B, H>
impl<const B: usize, const H: usize> Send for HammingHasher<B, H>
impl<const B: usize, const H: usize> Sync for HammingHasher<B, H>
impl<const B: usize, const H: usize> Unpin for HammingHasher<B, H>
impl<const B: usize, const H: usize> UnwindSafe for HammingHasher<B, H>
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