[−][src]Struct update_rate::RollingRateCounter
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]
fn clone(&self) -> RollingRateCounter
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for RollingRateCounter
[src]
impl Display for RollingRateCounter
[src]
impl RateCounter for RollingRateCounter
[src]
Auto Trait Implementations
impl RefUnwindSafe for RollingRateCounter
impl Send for RollingRateCounter
impl Sync for RollingRateCounter
impl Unpin for RollingRateCounter
impl UnwindSafe for RollingRateCounter
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,