pub struct Gauge<N = u64, A = AtomicU64> { /* private fields */ }Expand description
Open Metrics Gauge to record current measurements.
Single increasing, decreasing or constant value metric.
Gauge is generic over the actual data type tracking the Gauge state
as well as the data type used to interact with the Gauge. Out of
convenience the generic type parameters are set to use an AtomicU64 as a
storage and u64 on the interface by default.
§Examples
§Using AtomicU64 as storage and u64 on the interface
let gauge: Gauge = Gauge::default();
gauge.set(42u64);
let _value: u64 = gauge.get();§Using AtomicU64 as storage and f64 on the interface
let gauge = Gauge::<f64, AtomicU64>::default();
gauge.set(42.0);
let _value: f64 = gauge.get();Implementations§
Trait Implementations§
Source§impl<N, A> EncodeMetric for Gauge<N, A>
impl<N, A> EncodeMetric for Gauge<N, A>
Source§impl<N, A> TypedMetric for Gauge<N, A>
impl<N, A> TypedMetric for Gauge<N, A>
const TYPE: MetricType = MetricType::Gauge
Auto Trait Implementations§
impl<N, A> Freeze for Gauge<N, A>
impl<N, A> RefUnwindSafe for Gauge<N, A>where
N: RefUnwindSafe,
A: RefUnwindSafe,
impl<N, A> Send for Gauge<N, A>
impl<N, A> Sync for Gauge<N, A>
impl<N, A> Unpin for Gauge<N, A>where
N: Unpin,
impl<N, A> UnwindSafe for Gauge<N, A>where
A: RefUnwindSafe,
N: 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