Struct multibloom::BloomFilter [] [src]

pub struct BloomFilter {
    // some fields omitted
}

Methods

impl BloomFilter
[src]

fn new(size: usize, hash_count: usize) -> BloomFilter

Constructs a new BloomFilter

Takes size and hash_count. These correspond to m and k in standard Bloom Filter Descriptions.

size: The size of the bit vector being stored. (m) hash_count: The number of hash functions to use. (k)

fn new_with_params(n: usize, p: f32) -> BloomFilter

Constructs a new BloomFilter using desired error rate and number of items

n: The number of items that are going to be stored in the bloom filter. p: The allowable error rate of false positives

fn add<T: Hash>(&mut self, val: T)

Add a Hashable type to the bloom filter.

fn query<T: Hash>(&self, query_val: T) -> bool

Query the bloom filter for some Hashable value.

fn get_bits_set(&self) -> usize

Returns the number of bits set in the bloom filter.

This is an expensive operation, there's no reason to use it unless you're doing something strange

fn clear(&mut self)

Clears the bloom filter of all values.

Trait Implementations

impl Debug for BloomFilter
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.