[][src]Struct metrix::instruments::Gauge

pub struct Gauge { /* fields omitted */ }

Simply returns the value that has been observed last.

Reacts to the following Observation:

  • Obervation::ObservedOneValue(Update::ObservationWithValue)

Example

use std::time::Instant;
use metrix::instruments::*;

let mut gauge = Gauge::new_with_defaults("example");
assert_eq!(None, gauge.get());
let update = Update::ObservationWithValue(12, Instant::now());
gauge.update(&update);

assert_eq!(Some(12), gauge.get());

Methods

impl Gauge[src]

pub fn new_with_defaults<T: Into<String>>(name: T) -> Gauge[src]

pub fn set(&mut self, v: u64)[src]

pub fn get(&self) -> Option<i64>[src]

pub fn set_memorize_extrema(&mut self, d: Duration)[src]

If set to Some(Duration) a peak and bottom values will be displayed for the given duration unless there is a new peak or bottom which will reset the timer. The fields has the names [gauge_name]_peak and [gauge_name]_bottom

If set to None the peak and bottom values will not be shown.

pub fn name(&self) -> &str[src]

Gets the name of this Gauge

pub fn set_name<T: Into<String>>(&mut self, name: T)[src]

Set the name if this Gauge.

The name is a path segment within a Snapshot

pub fn set_title<T: Into<String>>(&mut self, title: T)[src]

Sets the title of this Gauge.

A title can be part of a descriptive Snapshot

pub fn set_description<T: Into<String>>(&mut self, description: T)[src]

Sets the description of this Gauge.

A description can be part of a descriptive Snapshot

Trait Implementations

impl Updates for Gauge[src]

impl Instrument for Gauge[src]

impl Descriptive for Gauge[src]

impl PutsSnapshot for Gauge[src]

Auto Trait Implementations

impl Send for Gauge

impl Sync for Gauge

impl Unpin for Gauge

impl UnwindSafe for Gauge

impl RefUnwindSafe for Gauge

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,