[−][src]Struct bloom2::BloomFilterBuilder
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]
H: BuildHasher,
B: Bitmap,
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]
H: BuildHasher,
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).
pub fn default() -> BloomFilterBuilder<RandomState, CompressedBitmap>
[src]
Auto Trait Implementations
impl<H, B> RefUnwindSafe for BloomFilterBuilder<H, B> where
B: RefUnwindSafe,
H: RefUnwindSafe,
[src]
B: RefUnwindSafe,
H: RefUnwindSafe,
impl<H, B> Send for BloomFilterBuilder<H, B> where
B: Send,
H: Send,
[src]
B: Send,
H: Send,
impl<H, B> Sync for BloomFilterBuilder<H, B> where
B: Sync,
H: Sync,
[src]
B: Sync,
H: Sync,
impl<H, B> Unpin for BloomFilterBuilder<H, B> where
B: Unpin,
H: Unpin,
[src]
B: Unpin,
H: Unpin,
impl<H, B> UnwindSafe for BloomFilterBuilder<H, B> where
B: UnwindSafe,
H: UnwindSafe,
[src]
B: UnwindSafe,
H: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,