Struct Enum

Source
pub struct Enum<K>
where K: Flatten,
{ /* private fields */ }
Expand description

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 array of numbers, in the order of enum values.

Implementations§

Source§

impl<K> Enum<K>
where K: Flatten,

Source

pub fn new(service: &Service, name: String) -> Enum<K>

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§

Source§

impl<K> Clone for Enum<K>
where K: Flatten,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<K> Histogram<K> for Enum<K>
where K: Flatten,

Source§

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

Record a value in this histogram, as provided by a callback. Read more
Source§

fn record(&self, value: T)

Record a value in this histogram. Read more

Auto Trait Implementations§

§

impl<K> Freeze for Enum<K>

§

impl<K> RefUnwindSafe for Enum<K>
where K: RefUnwindSafe,

§

impl<K> Send for Enum<K>
where K: Send,

§

impl<K> Sync for Enum<K>
where K: Sync,

§

impl<K> Unpin for Enum<K>
where K: Unpin,

§

impl<K> UnwindSafe for Enum<K>
where K: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.