Struct metrix::instruments::Counter[][src]

pub struct Counter { /* fields omitted */ }

A simple ever increasing counter

Reacts to the following Observations:

  • Observation::Observed(Update::Observations)
  • Obervation::ObservedOne(Update::Observation)
  • Obervation::ObservedOneValue(Update::ObservationWithValue)

Example

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

let mut counter = Counter::new_with_defaults("example");
let update = Update::Observation(Instant::now());
counter.update(&update);

assert_eq!(1, counter.get());

Methods

impl Counter
[src]

Increase the stored value by one.

Increase the stored value by n

Get the current value

Gets the name of this Counter

Set the name if this Counter.

The name is a path segment within a Snapshot

Sets the title of this Counter.

A title can be part of a descriptive Snapshot

Sets the description of this Counter.

A description can be part of a descriptive Snapshot

Trait Implementations

impl Instrument for Counter
[src]

impl PutsSnapshot for Counter
[src]

Puts the current snapshot values into the given Snapshot thereby following the guidelines of PutsSnapshot. Read more

impl Updates for Counter
[src]

Update the internal state according to the given Update. Read more

impl Descriptive for Counter
[src]

Auto Trait Implementations

impl Send for Counter

impl Sync for Counter