pub struct Builder { /* private fields */ }Expand description
A builder type for ExponentialDecayHistogram objects.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn at(&mut self, now: Instant) -> &mut Self
pub fn at(&mut self, now: Instant) -> &mut Self
Sets the construction time of the histogram.
Defaults to the system time when the Builder was constructed.
Sourcepub fn size(&mut self, size: usize) -> &mut Self
pub fn size(&mut self, size: usize) -> &mut Self
Sets the size of the histogram.
A larger size will provide a more accurate histogram, but with a higher memory overhead.
Defaults to 1028, which offers a 99.9% confidence level with a 5% margin of error.
§Panics
Panics if size is 0.
Sourcepub fn alpha(&mut self, alpha: f64) -> &mut Self
pub fn alpha(&mut self, alpha: f64) -> &mut Self
Sets the decay rate of the histogram.
A larger value biases the histogram towards newer values.
Defaults to 0.015, which heavily biases towards the last 5 minutes of values.
Sourcepub fn build(&self) -> ExponentialDecayHistogram
pub fn build(&self) -> ExponentialDecayHistogram
Creates a new ExponentialDecayHistogram.
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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