Struct libbgs::markoff::BloomFilter
source · pub struct BloomFilter<T, F> { /* private fields */ }
Expand description
A Bloom Filter, a probabilistic set. Elements may be added to the filter, and then the filter may be tested for membership, with false positives. The false positivity rate is determined by the size of the Bloom filter and the number of hashes.
Implementations§
source§impl<T, F> BloomFilter<T, F>where
F: Fn(&T) -> usize + Send + Sync,
impl<T, F> BloomFilter<T, F>where F: Fn(&T) -> usize + Send + Sync,
sourcepub fn new(bits: usize, hashes: Vec<F>) -> BloomFilter<T, F>
pub fn new(bits: usize, hashes: Vec<F>) -> BloomFilter<T, F>
Create a new Bloom filter, with the given size in bits and the given list of hashes to be applied to all members on addition and query.
sourcepub fn is_member_prob(&self, elem: &T) -> bool
pub fn is_member_prob(&self, elem: &T) -> bool
True if elem
is in the set.
If elem
is not in the set, this method returns False; i.e., this method return false
positives, but not false negatives.
Trait Implementations§
source§impl<T, F> Clone for BloomFilter<T, F>
impl<T, F> Clone for BloomFilter<T, F>
source§fn clone(&self) -> BloomFilter<T, F>
fn clone(&self) -> BloomFilter<T, F>
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 moreAuto Trait Implementations§
impl<T, F> RefUnwindSafe for BloomFilter<T, F>where F: RefUnwindSafe, T: RefUnwindSafe,
impl<T, F> Send for BloomFilter<T, F>where F: Send + Sync, T: Send,
impl<T, F> Sync for BloomFilter<T, F>where F: Send + Sync, T: Sync,
impl<T, F> Unpin for BloomFilter<T, F>where T: Unpin,
impl<T, F> UnwindSafe for BloomFilter<T, F>where F: RefUnwindSafe, T: 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