pub struct CMSketchAtomicUsize { /* private fields */ }Expand description
Count-Min Sketch that stores usize counters using atomics for concurrent updates.
Each bucket is backed by AtomicUsize, allowing lock-free increments and decrements.
Implementations§
Source§impl CMSketchAtomicUsize
impl CMSketchAtomicUsize
Sourcepub fn new(eps: f64, confidence: f64) -> Self
pub fn new(eps: f64, confidence: f64) -> Self
Creates a new atomic sketch sized by error eps and confidence.
See CMSketchU32::new for the mapping between
confidence and depth.
§Panics
Panics if eps <= 0.0 or confidence <= 0.0.
Sourcepub fn inc_by(&self, hash: u64, count: usize)
pub fn inc_by(&self, hash: u64, count: usize)
Atomically increments the count associated with hash by count.
Saturates at the maximum value representable by the counter type and leaves the bucket unchanged if the update would overflow.
Sourcepub fn dec_by(&self, hash: u64, count: usize)
pub fn dec_by(&self, hash: u64, count: usize)
Atomically decrements the count associated with hash by count.
Leaves the counter unchanged if it would underflow.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CMSketchAtomicUsize
impl RefUnwindSafe for CMSketchAtomicUsize
impl Send for CMSketchAtomicUsize
impl Sync for CMSketchAtomicUsize
impl Unpin for CMSketchAtomicUsize
impl UnwindSafe for CMSketchAtomicUsize
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