pub struct Estimator { /* private fields */ }
Expand description
An implementation of a lock-free count–min sketch estimator. See the wikipedia page for more information.
Implementations§
Source§impl Estimator
impl Estimator
Sourcepub fn new(hashes: usize, slots: usize) -> Self
pub fn new(hashes: usize, slots: usize) -> Self
Create a new Estimator
with the given amount of hashes and columns (slots).
Sourcepub fn incr<T: Hash>(&self, key: T, value: isize) -> isize
pub fn incr<T: Hash>(&self, key: T, value: isize) -> isize
Increment key
by the value given. Return the new estimated value as a result.
Note: overflow can happen. When some of the internal counters overflow, a negative number
will be returned. It is up to the caller to catch and handle this case.
Auto Trait Implementations§
impl Freeze for Estimator
impl RefUnwindSafe for Estimator
impl Send for Estimator
impl Sync for Estimator
impl Unpin for Estimator
impl UnwindSafe for Estimator
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