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

pub struct KeyedEnum<K, T> where
    K: ToString,
    T: Flatten
{ /* 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.

Implementations

impl<K, T> KeyedEnum<K, T> where
    K: ToString,
    T: Flatten
[src]

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

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> Clone for KeyedEnum<K, T> where
    K: ToString,
    T: Flatten
[src]

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

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

Record a value.

Actual recording takes place on the background thread.

Auto Trait Implementations

impl<K, T> !RefUnwindSafe for KeyedEnum<K, T>

impl<K, T> Send for KeyedEnum<K, T> where
    K: Send,
    T: Send

impl<K, T> !Sync for KeyedEnum<K, T>

impl<K, T> Unpin for KeyedEnum<K, T> where
    K: Unpin,
    T: Unpin

impl<K, T> !UnwindSafe for KeyedEnum<K, T>

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.