Trait prometheus::core::Atomic[][src]

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); }

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

Associated Types

type T: Number[src]

The numeric type associated with this atomic.

Loading content...

Required methods

fn new(val: Self::T) -> Self[src]

Create a new atomic value.

fn set(&self, val: Self::T)[src]

Set the value to the provided value.

fn get(&self) -> Self::T[src]

Get the value.

fn inc_by(&self, delta: Self::T)[src]

Increment the value by a given amount.

fn dec_by(&self, delta: Self::T)[src]

Decrement the value by a given amount.

Loading content...

Implementors

impl Atomic for AtomicF64[src]

type T = f64

impl Atomic for AtomicI64[src]

type T = i64

impl Atomic for AtomicU64[src]

type T = u64

Loading content...