pub trait RollingTimer {
type Tick: RollingSince + Promote + Div<Output = Self::Tick>;
const TICKS_PER_SECOND: Self::Tick;
// Required methods
fn get_ticks(&self) -> Self::Tick;
fn is_initialized(&self) -> bool;
// Provided methods
fn ticks_since(&self, rhs: Self::Tick) -> Self::Tick { ... }
fn seconds_since(&self, rhs: Self::Tick) -> Self::Tick { ... }
fn millis_since(&self, rhs: Self::Tick) -> Self::Tick { ... }
fn micros_since(&self, rhs: Self::Tick) -> Self::Tick { ... }
}Required Associated Constants§
const TICKS_PER_SECOND: Self::Tick
Required Associated Types§
Required Methods§
Sourcefn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
Determine if the timer is initialized
Provided Methods§
Sourcefn ticks_since(&self, rhs: Self::Tick) -> Self::Tick
fn ticks_since(&self, rhs: Self::Tick) -> Self::Tick
Get the number of ticks since the other measurement
Make sure the old value isn’t too stale.
NOTE: if the timer is not initialized, the timer may
return a tick value of 0 until it has been initialized.
Sourcefn seconds_since(&self, rhs: Self::Tick) -> Self::Tick
fn seconds_since(&self, rhs: Self::Tick) -> Self::Tick
Get the number of whole seconds since the other measurement
Make sure the old value isn’t too stale
Sourcefn millis_since(&self, rhs: Self::Tick) -> Self::Tick
fn millis_since(&self, rhs: Self::Tick) -> Self::Tick
Get the number of whole milliseconds since the other measurement
Make sure the old value isn’t too stale
If the number of milliseconds is larger than Self::Tick::max(), then it will saturate at the max value
Sourcefn micros_since(&self, rhs: Self::Tick) -> Self::Tick
fn micros_since(&self, rhs: Self::Tick) -> Self::Tick
Get the number of whole microseconds since the other measurement
Make sure the old value isn’t too stale
If the number of microseconds is larger than Self::Tick::max(), then it will saturate at the max value
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.