Trait Metric

Source
pub trait Metric<R>:
    Default
    + OnResultMut<R>
    + Clear
    + Serialize { }
Expand description

A trait to implement to be used in the measure! macro

Metrics wrap expressions to measure them.

The return type, R, of the expression can be captured to perform special handling.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C: Counter, R> Metric<R> for HitCount<C>

Source§

impl<C: Counter, T, E> Metric<Result<T, E>> for ErrorCount<C>

Source§

impl<G: Gauge, R> Metric<R> for InFlight<G>

Source§

impl<H: Histogram, T: Instant, R> Metric<R> for ResponseTime<H, T>

Source§

impl<P: RecordThroughput + Serialize + Clear, T: Instant, R> Metric<R> for Throughput<T, P>