pub struct ScalableCuckooFilter<T: ?Sized, H = DefaultHasher, R = DefaultRng> { /* private fields */ }
Expand description
Scalable Cuckoo Filter.
Implementations§
source§impl<T: Hash + ?Sized> ScalableCuckooFilter<T>
impl<T: Hash + ?Sized> ScalableCuckooFilter<T>
sourcepub fn new(
initial_capacity_hint: usize,
false_positive_probability: f64
) -> Self
pub fn new( initial_capacity_hint: usize, false_positive_probability: f64 ) -> Self
Makes a new ScalableCuckooFilter
instance.
This is equivalent to the following expression:
ScalableCuckooFilterBuilder::new()
.initial_capacity(initial_capacity)
.false_positive_probability(false_positive_probability)
.finish()
source§impl<T: Hash + ?Sized, H: Hasher + Clone, R: Rng> ScalableCuckooFilter<T, H, R>
impl<T: Hash + ?Sized, H: Hasher + Clone, R: Rng> ScalableCuckooFilter<T, H, R>
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the capacity (i.e., the upper bound of acceptable items count) of this filter.
“capacity” is upper bound of the number of items can be inserted into the filter without resizing.
sourcepub fn contains(&self, item: &T) -> bool
pub fn contains(&self, item: &T) -> bool
Returns true
if this filter may contain item
, otherwise false
.
sourcepub fn insert(&mut self, item: &T)
pub fn insert(&mut self, item: &T)
Inserts item
into this filter.
If the current filter becomes full, it will be expanded automatically.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of this filter as much as possible.
Trait Implementations§
Auto Trait Implementations§
impl<T: ?Sized, H, R> RefUnwindSafe for ScalableCuckooFilter<T, H, R>
impl<T: ?Sized, H, R> Send for ScalableCuckooFilter<T, H, R>
impl<T: ?Sized, H, R> Sync for ScalableCuckooFilter<T, H, R>
impl<T: ?Sized, H, R> Unpin for ScalableCuckooFilter<T, H, R>
impl<T: ?Sized, H, R> UnwindSafe for ScalableCuckooFilter<T, H, R>
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