Struct failsafe::WindowedAdder

source ·
pub struct WindowedAdder { /* private fields */ }
Expand description

Time windowed counter.

Implementations

Creates a new counter.

  • window - The range of time to be kept in the counter.
  • slices - The number of slices that are maintained; a higher number of slices means finer granularity but also more memory consumption. Must be more than 1 and less then 10.
Panics
  • When slices isn’t in range [1;10].

Purge outdated slices.

Resets state of the counter.

Increments counter by value.

Returns the current sum of the counter.

Trait Implementations

Formats the value using the given formatter. Read more

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.

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.