Struct bloomfilter::Bloom
[−]
[src]
pub struct Bloom { /* fields omitted */ }
Bloom filter structure
Methods
impl Bloom
[src]
fn new(bitmap_size: usize, items_count: usize) -> Bloom
Create a new bloom filter structure. bitmap_size is the size in bytes (not bits) that will be allocated in memory items_count is an estimation of the maximum number of items to store.
fn new_for_fp_rate(items_count: usize, fp_p: f64) -> Bloom
Create a new bloom filter structure. items_count is an estimation of the maximum number of items to store. fp_p is the wanted rate of false positives, in ]0.0, 1.0[
fn from_existing(
bitmap: &[u8],
bitmap_bits: u64,
k_num: u32,
sip_keys: [(u64, u64); 2]
) -> Bloom
bitmap: &[u8],
bitmap_bits: u64,
k_num: u32,
sip_keys: [(u64, u64); 2]
) -> Bloom
Create a bloom filter structure with an existing state. The state is assumed to be retrieved from an existing bloom filter.
fn compute_bitmap_size(items_count: usize, fp_p: f64) -> usize
Compute a recommended bitmap size for items_count items and a fp_p rate of false positives. fp_p obviously has to be within the ]0.0, 1.0[ range.
fn set<T>(&mut self, item: T) where
T: Hash,
T: Hash,
Record the presence of an item.
fn check<T>(&self, item: T) -> bool where
T: Hash,
T: Hash,
Check if an item is present in the set. There can be false positives, but no false negatives.
fn check_and_set<T>(&mut self, item: T) -> bool where
T: Hash,
T: Hash,
Record the presence of an item in the set, and return the previous state of this item.
fn bitmap(&self) -> Vec<u8>
Return the bitmap as a vector of bytes
fn number_of_bits(&self) -> u64
Return the number of bits in the filter
fn number_of_hash_functions(&self) -> u32
Return the number of hash functions used for check
and set
fn sip_keys(&self) -> [(u64, u64); 2]
Return the keys used by the sip hasher
fn clear(&mut self)
Clear all of the bits in the filter, removing all keys from the set