Expand description

This crate provides a BloomFilter trait which can be parameterized by different types of storage (via the BloomSet trait) to obtain traditional binary Bloom filters, counting Bloom filters, and spectral Bloom filters. For basic usage, see the documentation for SimpleBloomFilter.

BloomSet implementations are provided for BitBoxes (for traditional bitmap-style Bloom filters) and Box<[T]> where T is a numeric type (for counting or spectral Bloom filters).

Example

Basic usage:

use generic_bloom::{BloomFilter, SimpleBloomFilter};
use bitvec::prelude::*;

let mut filter: SimpleBloomFilter<BitBox<usize, Lsb0>> = SimpleBloomFilter::new(10, 20);
filter.insert(&48);
filter.insert(&32);
assert!(filter.contains(&48));
assert!(filter.contains(&32));
// May fail if 39 happens to be a false positive
assert!(!filter.contains(&39));

Re-exports

pub use traits::filter::*;
pub use traits::set::BloomSet;

Modules

Traits for Bloom filter functionality.

Structs

A Bloom filter with underlying set B and BuildHasher type S, the BuildHashers being held in a collection of type V. The supported operations are based on the traits implemented by B.