pub struct BloomFilter { /* private fields */ }Expand description
Bloom Filter for approximate set membership testing Useful for checking if nodes/edges exist without storing the full set
Implementations§
Source§impl BloomFilter
impl BloomFilter
Sourcepub fn new(expected_elements: usize, false_positive_rate: f64) -> Self
pub fn new(expected_elements: usize, false_positive_rate: f64) -> Self
Create new Bloom Filter expected_elements: expected number of elements false_positive_rate: desired false positive rate (0.0 - 1.0)
Sourcepub fn contains<T: Hash>(&self, element: &T) -> bool
pub fn contains<T: Hash>(&self, element: &T) -> bool
Check if an element might be in the set Returns true if element might be present (could be false positive) Returns false if element is definitely not present
Sourcepub fn false_positive_probability(&self) -> f64
pub fn false_positive_probability(&self) -> f64
Get current false positive probability estimate
Sourcepub fn union(&mut self, other: &BloomFilter) -> Result<()>
pub fn union(&mut self, other: &BloomFilter) -> Result<()>
Union with another Bloom Filter
Trait Implementations§
Source§impl Clone for BloomFilter
impl Clone for BloomFilter
Source§fn clone(&self) -> BloomFilter
fn clone(&self) -> BloomFilter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BloomFilter
impl RefUnwindSafe for BloomFilter
impl Send for BloomFilter
impl Sync for BloomFilter
impl Unpin for BloomFilter
impl UnsafeUnpin for BloomFilter
impl UnwindSafe for BloomFilter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more