Struct running_average::RealTimeRunningAverage[][src]

pub struct RealTimeRunningAverage<V: Default, TS: TimeSource = RealTimeSource> { /* fields omitted */ }

Represents running average calculation window where shift and measurement are using given time source to obtain value of now instant. It is using specified window width that will consist of given number of accumulator buckets to ensure constant memory usage.

Methods

impl<V: Default> RealTimeRunningAverage<V, RealTimeSource>
[src]

Crate new instance with window of given width duration and using RealTimeSource as time source for now instant. Note: new() is parametrizing output to RealTimeSource as this cannot be inferred otherwise.

impl<V: Default, TS: TimeSource> RealTimeRunningAverage<V, TS>
[src]

Crate new instance with window of given width duration and using given as time source for now instant.

Insert value to be average over now. Panics if time source time goes backwards.

Calculate running average using time window ending now. Panics if time source time goes backwards.

Return mutable reference to time source used.

Trait Implementations

impl<V: Debug + Default, TS: Debug + TimeSource> Debug for RealTimeRunningAverage<V, TS> where
    TS::Instant: Debug
[src]

Formats the value using the given formatter. Read more

impl<V: Default> Default for RealTimeRunningAverage<V, RealTimeSource>
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl<V, TS> Send for RealTimeRunningAverage<V, TS> where
    TS: Send,
    V: Send,
    <TS as TimeSource>::Instant: Send

impl<V, TS> Sync for RealTimeRunningAverage<V, TS> where
    TS: Sync,
    V: Sync,
    <TS as TimeSource>::Instant: Sync