Struct librualg::bloom_filter::BloomFilter [−][src]
pub struct BloomFilter { /* fields omitted */ }
Bloom Filter
use librualg::bloom_filter::BloomFilter;; let mut bloom_filter = BloomFilter::build(8 * 1024 * 1024, 1000000, 2); bloom_filter.insert("google"); bloom_filter.insert("facebook"); bloom_filter.insert("yandex"); assert_eq!(bloom_filter.contains("google"), true); assert_eq!(bloom_filter.contains("facebook"), true); assert_eq!(bloom_filter.contains("yandex"), true); assert_eq!(bloom_filter.contains("microsoft"), false); assert_eq!(bloom_filter.contains("oracle"), false); assert_eq!(bloom_filter.contains("redhat"), false);
Implementations
impl BloomFilter
[src]
pub fn build(n: usize, m: usize, k: usize) -> Self
[src]
Build Bloom Filter
Arguments
n
- bit array size (number of bytes)m
- number of inserted elementsk
- number hash functions
pub fn insert(&mut self, key: &str)
[src]
pub fn contains(&self, key: &str) -> bool
[src]
pub fn get_false_positive_probability(&self) -> f64
[src]
Auto Trait Implementations
impl RefUnwindSafe for BloomFilter
impl Send for BloomFilter
impl Sync for BloomFilter
impl Unpin for BloomFilter
impl UnwindSafe for BloomFilter
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>,