pub trait RateCounter {
// Required methods
fn samples(&self) -> u64;
fn set_samples(&mut self, samples: u64);
fn update(&mut self);
fn rate(&self) -> f64;
}
Expand description
Basic rate counter functionality.
Types which implement RateCounter also implement Display (a string with “
Required Methods§
Sourcefn samples(&self) -> u64
fn samples(&self) -> u64
Return the current number of samples the UpdateRateCounter is measuring.
Sourcefn set_samples(&mut self, samples: u64)
fn set_samples(&mut self, samples: u64)
Set the number of updates which the UpdateRateCounter considers.
§Panics
This function may panic if given a samples
value equal to 0.