pub trait BloomFilter {
// Required methods
fn add<T>(&mut self, value: &T) -> bool
where T: Hash;
fn contains<T>(&self, value: &T) -> bool
where T: Hash;
fn target_false_positive_rate(&self) -> f64;
fn current_false_positive_rate(&self) -> f64;
fn is_empty(&self) -> bool;
fn is_full(&self) -> bool;
fn size(&self) -> u64;
fn len(&self) -> u64;
}Expand description
Interface for bloom filter. Define all the function a bloom filter should implement.
Required Methods§
Sourcefn add<T>(&mut self, value: &T) -> boolwhere
T: Hash,
fn add<T>(&mut self, value: &T) -> boolwhere
T: Hash,
Add new element into the bloom filter. Return true when any key are inserted in a slice.
Sourcefn contains<T>(&self, value: &T) -> boolwhere
T: Hash,
fn contains<T>(&self, value: &T) -> boolwhere
T: Hash,
Check if the bloom filter contains the specific key. Return true when all key are present in all slices, which may contains false positive situation.
Sourcefn target_false_positive_rate(&self) -> f64
fn target_false_positive_rate(&self) -> f64
Get target false positive rate.
Sourcefn current_false_positive_rate(&self) -> f64
fn current_false_positive_rate(&self) -> f64
Get current false positive rate.
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.