pub struct QuotientFilter { /* private fields */ }Expand description
A Quotient Filter for approximate set membership with deletion support.
Implementations§
Source§impl QuotientFilter
impl QuotientFilter
Sourcepub fn new(config: QuotientFilterConfig) -> Self
pub fn new(config: QuotientFilterConfig) -> Self
Create a new Quotient Filter with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration.
Sourcepub fn load_factor(&self) -> f64
pub fn load_factor(&self) -> f64
Current load factor (0.0 to 1.0).
Sourcepub fn theoretical_fp_rate(&self) -> f64
pub fn theoretical_fp_rate(&self) -> f64
Theoretical false positive rate at current load.
Sourcepub fn insert<T: Hash>(&mut self, item: &T) -> bool
pub fn insert<T: Hash>(&mut self, item: &T) -> bool
Insert an element. Returns true if newly inserted, false if already present or full.
Sourcepub fn contains<T: Hash>(&self, item: &T) -> bool
pub fn contains<T: Hash>(&self, item: &T) -> bool
Check if an element might be in the filter.
Returns false for definite non-members (no false negatives).
Returns true for probable members (may have false positives
due to fingerprint collisions).
Sourcepub fn remove<T: Hash>(&mut self, item: &T) -> bool
pub fn remove<T: Hash>(&mut self, item: &T) -> bool
Remove an element. Returns true if it was found and removed.
Uses backward-shift deletion to maintain probe sequences.
Sourcepub fn merge(&mut self, other: &QuotientFilter) -> usize
pub fn merge(&mut self, other: &QuotientFilter) -> usize
Merge another filter into this one.
Both filters must have the same q and r values. Returns the number of new elements added.
Trait Implementations§
Source§impl Clone for QuotientFilter
impl Clone for QuotientFilter
Source§fn clone(&self) -> QuotientFilter
fn clone(&self) -> QuotientFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more