pub struct MetricsCounter<const N: usize> {
    slots: [(usize, Instant); N],
    index: usize,
}
Expand description

A metrics counter storing only latest N records.

Fields§

§slots: [(usize, Instant); N]

Slots to store metrics.

§index: usize

The slot of the oldest record. Also the next slot to store the new record.

Implementations§

Creates a new counter with an initial value.

Adds record to the counter.

Calculates per-second average rate of all slots.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.