Struct fastbloom_rs::FilterBuilder
source · [−]pub struct FilterBuilder {
pub expected_elements: u64,
pub false_positive_probability: f64,
pub size: u64,
pub hashes: u32,
/* private fields */
}Expand description
Builder for Bloom Filters.
Fields
expected_elements: u64false_positive_probability: f64size: u64hashes: u32Implementations
sourceimpl FilterBuilder
impl FilterBuilder
sourcepub fn new(expected_elements: u64, false_positive_probability: f64) -> Self
pub fn new(expected_elements: u64, false_positive_probability: f64) -> Self
Constructs a new Bloom Filter Builder by specifying the expected size of the filter and the tolerable false positive probability. The size of the BLoom filter in in bits and the optimal number of hash functions will be inferred from this.
Examples
use fastbloom_rs::FilterBuilder;
let mut builder = FilterBuilder::new(100_000_000, 0.01);
let bloom = builder.build_bloom_filter();
sourcepub fn from_size_and_hashes(size: u64, hashes: u32) -> Self
pub fn from_size_and_hashes(size: u64, hashes: u32) -> Self
Constructs a new Bloom Filter Builder by specifying the size of the bloom filter in bits and the number of hashes. The expected size of the filter and the tolerable false positive probability will be inferred from this.
sourcepub fn build_bloom_filter(&mut self) -> BloomFilter
pub fn build_bloom_filter(&mut self) -> BloomFilter
Constructs a Bloom filter using the specified parameters and computing missing parameters if possible (e.g. the optimal Bloom filter bit size).
Trait Implementations
sourceimpl Clone for FilterBuilder
impl Clone for FilterBuilder
sourcefn clone(&self) -> FilterBuilder
fn clone(&self) -> FilterBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for FilterBuilder
impl Send for FilterBuilder
impl Sync for FilterBuilder
impl Unpin for FilterBuilder
impl UnwindSafe for FilterBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more