Struct metrics_util::registry::Generational
source · pub struct Generational<T> { /* private fields */ }
Available on crate features
registry
and recency
only.Expand description
Generation tracking for a metric.
Holds a generic interior value, and provides way to access the value such that each access increments the “generation” of the value. This provides a means to understand if the value has been updated since the last time it was observed.
For example, if a gauge was observed to be X at one point in time, and then observed to be X
again at a later point in time, it could have changed in between the two observations. It also
may not have changed, and thus Generational
provides a way to determine if either of these
events occurred.
Implementations§
source§impl<T> Generational<T>
impl<T> Generational<T>
sourcepub fn get_generation(&self) -> Generation
pub fn get_generation(&self) -> Generation
Gets the current generation.
sourcepub fn with_increment<F, V>(&self, f: F) -> V
pub fn with_increment<F, V>(&self, f: F) -> V
Acquires a reference to the inner value, and increments the generation.
Trait Implementations§
source§impl<T: Clone> Clone for Generational<T>
impl<T: Clone> Clone for Generational<T>
source§fn clone(&self) -> Generational<T>
fn clone(&self) -> Generational<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> CounterFn for Generational<T>where
T: CounterFn,
impl<T> CounterFn for Generational<T>where
T: CounterFn,
source§impl<T> From<Generational<T>> for Counter
impl<T> From<Generational<T>> for Counter
source§fn from(inner: Generational<T>) -> Self
fn from(inner: Generational<T>) -> Self
Converts to this type from the input type.
source§impl<T> From<Generational<T>> for Gauge
impl<T> From<Generational<T>> for Gauge
source§fn from(inner: Generational<T>) -> Self
fn from(inner: Generational<T>) -> Self
Converts to this type from the input type.
source§impl<T> From<Generational<T>> for Histogram
impl<T> From<Generational<T>> for Histogram
source§fn from(inner: Generational<T>) -> Self
fn from(inner: Generational<T>) -> Self
Converts to this type from the input type.
source§impl<T> GaugeFn for Generational<T>where
T: GaugeFn,
impl<T> GaugeFn for Generational<T>where
T: GaugeFn,
source§impl<T> HistogramFn for Generational<T>where
T: HistogramFn,
impl<T> HistogramFn for Generational<T>where
T: HistogramFn,
Auto Trait Implementations§
impl<T> Freeze for Generational<T>where
T: Freeze,
impl<T> RefUnwindSafe for Generational<T>where
T: RefUnwindSafe,
impl<T> Send for Generational<T>where
T: Send,
impl<T> Sync for Generational<T>where
T: Sync,
impl<T> Unpin for Generational<T>where
T: Unpin,
impl<T> UnwindSafe for Generational<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more