Crate generic_bloom
source · [−]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
BitBox
es (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
Modules
Traits for Bloom filter functionality.
Structs
A Bloom filter with underlying set B
and BuildHasher
type
S
, the BuildHasher
s being held in a collection of type
V
. The supported operations are based on the traits implemented
by B
.