pub trait Metric {
// Required methods
fn add(&self, value: u64);
fn count(&self) -> u64;
fn reset(&self);
fn set(&self, value: u64);
// Provided method
fn inc(&self) { ... }
}
Expand description
Abstraction over the common metric operations.
An object implementing Metric
is expected to have an inner counter that
can be incremented and reset. The Metric
trait can be used for
implementing a metric system backend (or an aggregator).
Required Methods§
Provided Methods§
Implementations on Foreign Types§
Source§impl Metric for AtomicU64
impl Metric for AtomicU64
Source§fn add(&self, value: u64)
fn add(&self, value: u64)
Adds value
to the current counter.
According to
fetch_add
documentation,
in case of an integer overflow, the counter starts over from 0.