[−][src]Struct xx_bloomfilter::Bloom
Bloom filter structure
Methods
impl Bloom
[src]
pub fn new(bitmap_size: usize, items_count: usize) -> Self
[src]
Create a new bloom filter structure. bitmap_size is the size in bytes (not bits) that will be allocated in memory items_count is an estimation of the maximum number of items to store.
pub fn new_with_rate(items_count: usize, fp_p: f64) -> Self
[src]
Create a new bloom filter structure. items_count is an estimation of the maximum number of items to store. fp_p is the wanted rate of false positives, in ]0.0, 1.0[
extern crate xx_bloomfilter; extern crate rand; use xx_bloomfilter::Bloom; let mut bloom = Bloom::new_with_rate(1_000_000, 1e-6); let item: u64 = rand::random(); assert_eq!(false, bloom.check_and_add(&item)); assert_eq!(true, bloom.check(&item)); // Clear all values bloom.clear(); assert_eq!(false, bloom.check_and_add(&item));
pub fn from_existing_struct(other: &Bloom) -> Self
[src]
pub fn from_existing(
bitmap: &[u8],
bitmap_size: u64,
k: u64,
seeds: (u64, u64)
) -> Self
[src]
bitmap: &[u8],
bitmap_size: u64,
k: u64,
seeds: (u64, u64)
) -> Self
Create a bloom filter structure with an existing state. The state is assumed to be retrieved from an existing bloom filter.
pub fn compute_bitmap_size(items_count: usize, fp_p: f64) -> usize
[src]
Compute a recommended bitmap size for items_count items and a fp_p rate of false positives. fp_p has to be within the ]0.0, 1.0[ range.
pub fn add<T: Hash>(&mut self, item: &T)
[src]
Record the presence of an item.
pub fn check<T: Hash>(&self, item: &T) -> bool
[src]
Check if an item is present in the set. There can be false positives, but no false negatives.
pub fn check_and_add<T: Hash>(&mut self, item: &T) -> bool
[src]
Record the presence of an item in the set, and return the previous state of this item.
pub fn bitmap(&self) -> BitVec
[src]
Return the bitmap
pub fn number_of_bits(&self) -> u64
[src]
Return the number of bits in the filter
pub fn number_of_hash_functions(&self) -> u64
[src]
Return the number of hash functions used for check
and set
pub fn xx(&self) -> (XxHash64, XxHash64)
[src]
pub fn clear(&mut self)
[src]
Clear all of the bits in the filter, removing all keys from the set
Trait Implementations
impl Default for Bloom
[src]
impl<'_> From<&'_ Bloom> for SerdeBloom
[src]
impl<'_> From<&'_ SerdeBloom> for Bloom
[src]
fn from(serde_bloom: &SerdeBloom) -> Self
[src]
Auto Trait Implementations
impl Sync for Bloom
impl Send for Bloom
impl Unpin for Bloom
impl RefUnwindSafe for Bloom
impl UnwindSafe for Bloom
Blanket Implementations
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,