Struct telemetry::keyed::KeyedEnum [] [src]

pub struct KeyedEnum<K, T> where K: ToString, T: Flatten {
    // some fields omitted
}

Enumerated histograms.

Enumerated histogram generalize Count histograms to families of keys known at compile-time. They are useful, for instance, to know how often users have picked a specific choice from several, or how many times each kind of error has been triggered, etc.

With SerializationFormat::SimpleJson, these histograms are serialized as an object, one field per key (sorted), with value an array of numbers, in the order of enum values.

Methods

impl<K, T> KeyedEnum<K, T> where K: ToString, T: Flatten

fn new(service: &Service, name: String) -> KeyedEnum<K, T>

Create a new Enum histogram with a given name.

Argument name is used as key when processing and exporting the data. Each name must be unique to the Service.

Panics

If name is already used by another histogram in service.

Trait Implementations

impl<K, T> KeyedHistogram<K, T> for KeyedEnum<K, T> where K: ToString, T: Flatten

fn record_cb<F>(&self, cb: F) where F: FnOnce() -> Option<(K, T)>

fn record(&self, key: K, value: T)

impl<K, T> Clone for KeyedEnum<K, T> where K: ToString, T: Flatten

fn clone(&self) -> Self

fn clone_from(&mut self, source: &Self)