[][src]Struct bloom2::BloomFilterBuilder

pub struct BloomFilterBuilder<H, B> where
    H: BuildHasher,
    B: Bitmap
{ /* fields omitted */ }

Construct Bloom2 instances with varying parameters.

use std::collections::hash_map::RandomState;
use bloom2::{BloomFilterBuilder, FilterSize};

let mut filter = BloomFilterBuilder::default()
                    .hasher(RandomState::default())
                    .size(FilterSize::KeyBytes2)
                    .build();

filter.insert("success!");

Implementations

impl<H, B> BloomFilterBuilder<H, B> where
    H: BuildHasher,
    B: Bitmap
[src]

pub fn hasher(self, hasher: H) -> Self[src]

Set the hash algorithm.

pub unsafe fn bitmap(self, bitmap: B, key_size: FilterSize) -> Self[src]

Set the bit storage (bitmap) for the bloom filter.

Safety

This method is unsafe as it is assumed bitmap is of a sufficient size to hold any value in the range produced by the key size.

Providing a bitmap instance that is non-empty can be used to restore the state of a Bloom2 instance (although using serde can achieve this safely too).

pub fn build<T: Hash>(self) -> Bloom2<H, B, T>[src]

Initialise the Bloom2 instance with the provided parameters.

impl<H> BloomFilterBuilder<H, CompressedBitmap> where
    H: BuildHasher
[src]

pub fn size(self, size: FilterSize) -> Self[src]

Control the in-memory size and false-positive probability of the filter.

Setting the bitmap size replaces the current Bitmap instance with a new CompressedBitmap of the appropriate size.

See FilterSize.

Trait Implementations

impl Default for BloomFilterBuilder<RandomState, CompressedBitmap>[src]

Initialise a BloomFilterBuilder that unless changed, will construct a Bloom2 instance using a 2 byte key and use Rust's DefaultHasher (SipHash at the time of writing).

Auto Trait Implementations

impl<H, B> RefUnwindSafe for BloomFilterBuilder<H, B> where
    B: RefUnwindSafe,
    H: RefUnwindSafe
[src]

impl<H, B> Send for BloomFilterBuilder<H, B> where
    B: Send,
    H: Send
[src]

impl<H, B> Sync for BloomFilterBuilder<H, B> where
    B: Sync,
    H: Sync
[src]

impl<H, B> Unpin for BloomFilterBuilder<H, B> where
    B: Unpin,
    H: Unpin
[src]

impl<H, B> UnwindSafe for BloomFilterBuilder<H, B> where
    B: UnwindSafe,
    H: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.