Struct metrix::instruments::Gauge
[−]
[src]
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]
fn new_with_defaults<T: Into<String>>(name: T) -> Gauge
[src]
fn set(&mut self, v: u64)
[src]
fn get(&self) -> Option<u64>
[src]
fn name(&self) -> &str
[src]
Gets the name of this Gauge
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
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
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 PutsSnapshot for Gauge
[src]
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
[src]
Puts the current snapshot values into the given Snapshot
thereby following the guidelines of PutsSnapshot
. Read more
impl Updates for Gauge
[src]
fn update(&mut self, with: &Update)
[src]
Update the internal state according to the given Update
. Read more