BloomFilter

Trait BloomFilter 

Source
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§

Source

fn add<T>(&mut self, value: &T) -> bool
where T: Hash,

Add new element into the bloom filter. Return true when any key are inserted in a slice.

Source

fn contains<T>(&self, value: &T) -> bool
where 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.

Source

fn target_false_positive_rate(&self) -> f64

Get target false positive rate.

Source

fn current_false_positive_rate(&self) -> f64

Get current false positive rate.

Source

fn is_empty(&self) -> bool

If this bloom filter is empty.

Source

fn is_full(&self) -> bool

If this bloom filter is full.

Source

fn size(&self) -> u64

Get the number of inserted elements in this bloom filter.

Source

fn len(&self) -> u64

Get the number of inserted bits in all slices.

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.

Implementors§