pub struct CMSketchAtomicU16 { /* private fields */ }Expand description
Count-Min Sketch that stores u16 counters using atomics for concurrent updates.
Each bucket is backed by AtomicU16, allowing lock-free increments and decrements.
Implementations§
Source§impl CMSketchAtomicU16
impl CMSketchAtomicU16
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: u16)
pub fn inc_by(&self, hash: u64, count: u16)
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CMSketchAtomicU16
impl RefUnwindSafe for CMSketchAtomicU16
impl Send for CMSketchAtomicU16
impl Sync for CMSketchAtomicU16
impl Unpin for CMSketchAtomicU16
impl UnwindSafe for CMSketchAtomicU16
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