Struct prometheus::local::AFLocalCounter

source ·
pub struct AFLocalCounter<T: 'static + MayFlush, V: CounterWithValueType, D: CounterDelegator<T, V>> { /* private fields */ }
Expand description

Auto flush-able local counter

Implementations§

source§

impl<T: 'static + MayFlush, V: CounterWithValueType, D: CounterDelegator<T, V>> AFLocalCounter<T, V, D>

source

pub fn new(delegator: D) -> AFLocalCounter<T, V, D>

Construct a new AFLocalCounter from delegator.

source§

impl<T: 'static + MayFlush, V: CounterWithValueType, D: CounterDelegator<T, V>> AFLocalCounter<T, V, D>

Auto flush-able local counter

source

pub fn inc_by(&self, v: <V::ValueType as Atomic>::T)

Increase the given value to the local counter, and try to flush to global

§Panics

Panics in debug build if the value is < 0.

source

pub fn inc(&self)

Increase the local counter by 1, and try to flush to global.

source

pub fn get(&self) -> <V::ValueType as Atomic>::T

Return the local counter value.

source

pub fn reset(&self)

Restart the counter, resetting its value back to 0.

source

pub fn flush(&self)

trigger flush of LocalKey

Trait Implementations§

source§

impl<T: Debug + 'static + MayFlush, V: Debug + CounterWithValueType, D: Debug + CounterDelegator<T, V>> Debug for AFLocalCounter<T, V, D>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, V, D> Freeze for AFLocalCounter<T, V, D>
where D: Freeze,

§

impl<T, V, D> !RefUnwindSafe for AFLocalCounter<T, V, D>

§

impl<T, V, D> Send for AFLocalCounter<T, V, D>
where D: Send, T: Send, V: Send,

§

impl<T, V, D> Sync for AFLocalCounter<T, V, D>
where D: Sync, T: Send, V: Send,

§

impl<T, V, D> Unpin for AFLocalCounter<T, V, D>
where D: Unpin, T: Unpin, V: Unpin,

§

impl<T, V, D> UnwindSafe for AFLocalCounter<T, V, D>
where D: UnwindSafe, T: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.