pub struct BloomFilter { /* private fields */ }Expand description
Bloom filter for membership testing with false positives
Implementations§
Source§impl BloomFilter
impl BloomFilter
Sourcepub fn new(capacity: usize, false_positive_rate: f64) -> Self
pub fn new(capacity: usize, false_positive_rate: f64) -> Self
Create a new Bloom filter with optimal parameters for given capacity and false positive rate
Sourcepub fn with_parameters(size: usize, hash_functions: usize) -> Self
pub fn with_parameters(size: usize, hash_functions: usize) -> Self
Create a new Bloom filter with explicit parameters
Sourcepub fn contains<T: Hash>(&self, item: &T) -> bool
pub fn contains<T: Hash>(&self, item: &T) -> bool
Test if an item might be in the filter (no false negatives, possible false positives)
Sourcepub fn false_positive_probability(&self) -> f64
pub fn false_positive_probability(&self) -> f64
Get the current false positive probability
Sourcepub fn stats(&self) -> BloomFilterStats
pub fn stats(&self) -> BloomFilterStats
Get filter statistics
Auto Trait Implementations§
impl Freeze for BloomFilter
impl RefUnwindSafe for BloomFilter
impl Send for BloomFilter
impl Sync for BloomFilter
impl Unpin for BloomFilter
impl UnwindSafe for BloomFilter
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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