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]
impl Gauge
pub fn new_with_defaults<T: Into<String>>(name: T) -> Gauge
[src]
pub fn new_with_defaults<T: Into<String>>(name: T) -> Gauge
pub fn set(&mut self, v: u64)
[src]
pub fn set(&mut self, v: u64)
pub fn get(&self) -> Option<u64>
[src]
pub fn get(&self) -> Option<u64>
pub fn name(&self) -> &str
[src]
pub fn name(&self) -> &str
Gets the name of this Gauge
pub fn set_name<T: Into<String>>(&mut self, name: T)
[src]
pub fn set_name<T: Into<String>>(&mut self, name: T)
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]
pub fn set_title<T: Into<String>>(&mut self, title: T)
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]
pub fn set_description<T: Into<String>>(&mut self, description: T)
Sets the description
of this Gauge
.
A description can be part of a descriptive Snapshot
Trait Implementations
impl Instrument for Gauge
[src]
impl Instrument for Gauge
impl PutsSnapshot for Gauge
[src]
impl PutsSnapshot for Gauge
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
[src]
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
Puts the current snapshot values into the given Snapshot
thereby following the guidelines of PutsSnapshot
. Read more
impl Updates for Gauge
[src]
impl Updates for Gauge
fn update(&mut self, with: &Update)
[src]
fn update(&mut self, with: &Update)
Update the internal state according to the given Update
. Read more
impl Descriptive for Gauge
[src]
impl Descriptive for Gauge