pub struct Filter(/* private fields */);Expand description
Inventory filter used for subscriptions and inventory comparison.
The Default instance has all bits set to 1, ie. it will match
everything.
Implementations§
Methods from Deref<Target = BloomFilter<RepoId>>§
Sourcepub fn insert(&mut self, item: &K)
pub fn insert(&mut self, item: &K)
Set an item in the Bloom filter. This operation is idempotent with regards to each unique item. Each item must implement the Hash trait.
Sourcepub fn contains(&self, item: &K) -> bool
pub fn contains(&self, item: &K) -> bool
Return whether or not a given item is likely in the Bloom filter or not. There is a
possibility for a false positive with the probability being under the Bloom filter’s p
value, but a false negative will never occur.
Sourcepub fn similarity(&self, other: &BloomFilter<K>) -> f64
pub fn similarity(&self, other: &BloomFilter<K>) -> f64
Compute the approximate similarity between two filters using the Jaccard Index.
Sourcepub fn overlap(&self, other: &BloomFilter<K>) -> f64
pub fn overlap(&self, other: &BloomFilter<K>) -> f64
Compute the approximate overlap between two filters using the overlap coefficient.
Sourcepub fn union(&self, other: &BloomFilter<K>) -> BloomFilter<K>
pub fn union(&self, other: &BloomFilter<K>) -> BloomFilter<K>
Compute the union of two Bloom filters.
Sourcepub fn intersection(&self, other: &BloomFilter<K>) -> BloomFilter<K>
pub fn intersection(&self, other: &BloomFilter<K>) -> BloomFilter<K>
Compute the intersection of two Bloom filters.
Sourcepub fn is_comparable(&self, other: &BloomFilter<K>) -> bool
pub fn is_comparable(&self, other: &BloomFilter<K>) -> bool
Check whether two filters can be compared, intersected and unioned.
Trait Implementations§
Source§impl From<BloomFilter<RepoId>> for Filter
impl From<BloomFilter<RepoId>> for Filter
Source§fn from(bloom: BloomFilter<RepoId>) -> Self
fn from(bloom: BloomFilter<RepoId>) -> Self
impl Eq for Filter
impl StructuralPartialEq for Filter
Auto Trait Implementations§
impl Freeze for Filter
impl RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnwindSafe for Filter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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