pub trait AtomicMinHash<AtomicWord: AtomicFetchMin, const PERMUTATIONS: usize>where
Self: IterHashes<AtomicWord::Word, PERMUTATIONS>,
AtomicWord::Word: Min + XorShift + Copy + Eq,
u64: Primitive<<AtomicWord as AtomicFetchMin>::Word>,{
// Required method
fn iter_atomic<'a>(&'a self) -> impl Iterator<Item = &'a AtomicWord>
where AtomicWord: 'a,
Self: 'a;
// Provided methods
fn fetch_insert_with_siphashes13<H: Hash>(
&self,
value: H,
ordering: Ordering,
) { ... }
fn fetch_insert_with_keyed_siphashes13<H: Hash>(
&self,
value: H,
key0: u64,
key1: u64,
ordering: Ordering,
) { ... }
}
Required Methods§
Sourcefn iter_atomic<'a>(&'a self) -> impl Iterator<Item = &'a AtomicWord>where
AtomicWord: 'a,
Self: 'a,
fn iter_atomic<'a>(&'a self) -> impl Iterator<Item = &'a AtomicWord>where
AtomicWord: 'a,
Self: 'a,
Iterate over the words.
Provided Methods§
Sourcefn fetch_insert_with_siphashes13<H: Hash>(&self, value: H, ordering: Ordering)
fn fetch_insert_with_siphashes13<H: Hash>(&self, value: H, ordering: Ordering)
Insert a value into the MinHash atomically, with SipHasher13.
§Arguments
value
- The value to insert.
§Examples
use minhash_rs::prelude::*;
let mut minhash = MinHash::<u64, 4>::new();
assert!(!minhash.may_contain_value_with_siphashes13(42));
minhash.fetch_insert_with_siphashes13(42, core::sync::atomic::Ordering::Relaxed);
assert!(!minhash.is_empty());
assert!(
minhash.may_contain_value_with_siphashes13(42),
concat!(
"The MinHash should contain the value 42, ",
"but it does not. The MinHash is: {:?}. ",
"The hashes associated to the value 42 are: {:?}."
),
minhash,
MinHash::<u64, 4>::iter_siphashes13_from_value(42).collect::<Vec<_>>()
);
minhash.fetch_insert_with_siphashes13(47, core::sync::atomic::Ordering::Relaxed);
assert!(minhash.may_contain_value_with_siphashes13(47));
Sourcefn fetch_insert_with_keyed_siphashes13<H: Hash>(
&self,
value: H,
key0: u64,
key1: u64,
ordering: Ordering,
)
fn fetch_insert_with_keyed_siphashes13<H: Hash>( &self, value: H, key0: u64, key1: u64, ordering: Ordering, )
Insert a value into the MinHash atomically, with keyed SipHasher13.
§Arguments
value
- The value to insert.key0
- The first key.key1
- The second key.
§Examples
use minhash_rs::prelude::*;
let mut minhash = MinHash::<u64, 4>::new();
let key0 = 0x0123456789ABCDEF;
let key1 = 0xFEDCBA9876543210;
assert!(!minhash.may_contain_value_with_keyed_siphashes13(42, key0, key1));
minhash.fetch_insert_with_keyed_siphashes13(42, key0, key1, core::sync::atomic::Ordering::Relaxed);
assert!(!minhash.is_empty());
assert!(
minhash.may_contain_value_with_keyed_siphashes13(42, key0, key1),
concat!(
"The MinHash should contain the value 42, ",
"but it does not. The MinHash is: {:?}. ",
"The hashes associated to the value 42 are: {:?}."
),
minhash,
MinHash::<u64, 4>::iter_keyed_siphashes13_from_value(42, key0, key1).collect::<Vec<_>>()
);
minhash.fetch_insert_with_keyed_siphashes13(47, key0, key1, core::sync::atomic::Ordering::Relaxed);
assert!(minhash.may_contain_value_with_keyed_siphashes13(47, key0, key1));
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.