[][src]Trait update_rate::RateCounterImmut

pub trait RateCounterImmut: RateCounter {
    fn update_immut(self) -> Self;
}

Immutable extensions for rate counters.

Required methods

fn update_immut(self) -> Self

Consumes the struct and returns an updated version. Call either this OR update() at the beginning of each cycle of the periodic activity being measured.

Loading content...

Implementors

impl RateCounterImmut for DiscreteRateCounter[src]

fn update_immut(self) -> Self[src]

Consumes the struct and returns an updated version. Call this at the beginning of each cycle of the periodic activity being measured.

Examples

use update_rate::DiscreteRateCounter;
use update_rate::{RateCounter, RateCounterImmut};
let c = DiscreteRateCounter::new(5);
for i in 1..101 {
    let c = c.update_immut();
    if i % 10 == 0 {println!("Rate: {}", c.rate())}
    // Do work here
}
Loading content...