pub trait Atomic: Send + Sync {
    type T: Number;

    fn new(val: Self::T) -> Self;
    fn set(&self, val: Self::T);
    fn get(&self) -> Self::T;
    fn inc_by(&self, delta: Self::T);
    fn dec_by(&self, delta: Self::T);
}
Expand description

An interface for atomics. Used to generically model float metrics and integer metrics, i.e. Counter and IntCounter.

Required Associated Types

The numeric type associated with this atomic.

Required Methods

Create a new atomic value.

Set the value to the provided value.

Get the value.

Increment the value by a given amount.

Decrement the value by a given amount.

Implementors