Trait prometheus::core::Atomic

source ·
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§

source

type T: Number

The numeric type associated with this atomic.

Required Methods§

source

fn new(val: Self::T) -> Self

Create a new atomic value.

source

fn set(&self, val: Self::T)

Set the value to the provided value.

source

fn get(&self) -> Self::T

Get the value.

source

fn inc_by(&self, delta: Self::T)

Increment the value by a given amount.

source

fn dec_by(&self, delta: Self::T)

Decrement the value by a given amount.

Object Safety§

This trait is not object safe.

Implementors§