pub struct BloomFilter { /* private fields */ }
Expand description

A Bloom filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970, that is used to test whether an element is a member of a set. False positive matches are possible, but false negatives are not.

Reference: Bloom, B. H. (1970). Space/time trade-offs in hash coding with allowable errors. Communications of the ACM, 13(7), 422-426. Full text article

Implementations

Build a Bloom filter form FilterBuilder.

Examples:
use fastbloom_rs::{BloomFilter, FilterBuilder};

let builder = FilterBuilder::new(100_000_000, 0.01);
let bloom = BloomFilter::new(builder);

Build a Bloom filter form &[u8].

Examples
use fastbloom_rs::BloomFilter;
let mut array = vec![0u8; 4096];
let bloom = BloomFilter::from_u8_array(array.as_bytes(), 4);

Build a Bloom filter form &[u16].

Examples
use fastbloom_rs::BloomFilter;
let mut array = vec![0u16; 2048];
let bloom = BloomFilter::from_u16_array(array.as_bytes(), 4);

Build a Bloom filter form &[u32].

Examples
use fastbloom_rs::BloomFilter;
let mut array = vec![0u32; 1024];
let bloom = BloomFilter::from_u32_array(array.as_bytes(), 4);

Build a Bloom filter form &[u64].

Examples
use fastbloom_rs::BloomFilter;
let mut array = vec![0u64; 512];
let bloom = BloomFilter::from_u32_array(array.as_bytes(), 4);

Returns the configuration/builder of the Bloom filter.

Examples
use fastbloom_rs::{BloomFilter, FilterBuilder};

let bloom = FilterBuilder::new(100_000_000, 0.01).build_bloom_filter();
let builder = bloom.config();

Returns the hash function number of the Bloom filter.

Adds the passed value to the filter.

Removes all elements from the filter (i.e. resets all bits to zero).

Tests whether an element is present in the filter (subject to the specified false positive rate).

Return the underlying byte vector of the Bloom filter.

Return the underlying u16 vector of the Bloom filter.

Return the underlying u32 vector of the Bloom filter.

Return the underlying u64 vector of the Bloom filter.

Performs the union operation on two compatible bloom filters. This is achieved through a bitwise OR operation on their bit vectors. This operations is lossless, i.e. no elements are lost and the bloom filter is the same that would have resulted if all elements wer directly inserted in just one bloom filter.

Performs the intersection operation on two compatible bloom filters. This is achieved through a bitwise AND operation on their bit vectors. The operations doesn’t introduce any false negatives but it does raise the false positive probability. The the false positive probability in the resulting Bloom filter is at most the false-positive probability in one of the constituent bloom filters

Returns true if the Bloom filter does not contain any elements

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.