Provides a way to build a bloom filter with optional fields,
such as customizing the Hasher used or the number of
hash functions used in its representation. Will use a DefaultHasher
if no other hasher is specified, and will use the optimal number
of hash functions depending on the number of items by default.
The default hasher for the bloom filter simply takes the first
8 bytes from a sha256 hash of an item and reads that
as a big-endian, u64 number. It implements the Hasher trait.
Hasher defines a struct that can produce a u64 from an item that can be
referenced as a byte slice. Our bloom filter implementation maps
the output number from this hash function to indices in its internal
representation.
Computes the optimal bits needed to store n items with an expected false positive
rate in the range [0, 1.0]. The formula is derived analytically as a well-known
result for bloom filters, computed as follows:
Computes the optimal number of hash functions needed a bloom filter
with an expected n num_items, and a desired false positive rate.
Rounds up to the nearest integer.