[][src]Struct update_rate::RollingRateCounter

pub struct RollingRateCounter { /* fields omitted */ }

A rolling update counter. It records as many updates as the given sample rate and re-calculates the average update time on each call to update.

Generally, this is to be preferred over the discrete version. However, for very high values of sample, this can be quite inefficient, especially if the rate value isn't needed during each cycle.

Usage

Call .update() every time your system starts a new update/cycle; for instance, an FPS counter would call this at the beginning of every frame. The sample rate (set with set_sample_rate() and in the first argument to new()) governs how many .update() calls are required before a meaningful result is produced.

You can also use .update_immut() for this to avoid a mutable binding.

Implementations

impl RollingRateCounter[src]

pub fn new(samples: u64) -> Self[src]

Create a new RollingRateCounter which calculates the update rate every update, averaging over a window of update_rate cycles.

Panics

This function will panic if given a value of samples equal to 0.

Trait Implementations

impl Clone for RollingRateCounter[src]

impl Debug for RollingRateCounter[src]

impl Display for RollingRateCounter[src]

impl RateCounter for RollingRateCounter[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.