pub trait Atomic: Send + Sync {
type T: Number;
// Required methods
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§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.