pub struct LockFreeHistogram<const N: usize> { /* private fields */ }
Expand description
A LockFreeHistogram. This trades the ability to resize to accomodate new observations as Histogram does in exchange for providing a concurrent, lock-free histogram.
Implementations§
Source§impl<const N: usize> LockFreeHistogram<N>
impl<const N: usize> LockFreeHistogram<N>
Sourcepub const fn new(sig_figs: i32) -> Self
pub const fn new(sig_figs: i32) -> Self
Create a new lock-free histogram with the specified number of sig_figs.
§Panics
Under the same conditions as SigFigBucketizer::new.
Sourcepub fn sig_figs(&self) -> i32
pub fn sig_figs(&self) -> i32
Return the nubmer of significant figures in use for this histogram.
Sourcepub fn observe(&self, x: f64) -> Result<(), Error>
pub fn observe(&self, x: f64) -> Result<(), Error>
Observe a value x and increment the bucket for x.
This will fail with Error::ExceedsMax if the bucket exceeds template parameter N.
Sourcepub fn observe_n(&self, x: f64, n: u64) -> Result<(), Error>
pub fn observe_n(&self, x: f64, n: u64) -> Result<(), Error>
Observe a value x and increment its bucket n times.
This will fail with Error::ExceedsMax if the bucket exceeds template parameter N.
Sourcepub fn to_histogram(&self) -> Histogram
pub fn to_histogram(&self) -> Histogram
Create a Histogram from this histogram.
Auto Trait Implementations§
impl<const N: usize> !Freeze for LockFreeHistogram<N>
impl<const N: usize> RefUnwindSafe for LockFreeHistogram<N>
impl<const N: usize> Send for LockFreeHistogram<N>
impl<const N: usize> Sync for LockFreeHistogram<N>
impl<const N: usize> Unpin for LockFreeHistogram<N>
impl<const N: usize> UnwindSafe for LockFreeHistogram<N>
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