pub trait TickInstant: Clone {
// Required methods
fn frequency() -> KilohertzU32;
fn now() -> Self;
fn elapsed(&mut self) -> TickDuration<Self>;
fn move_forward(&mut self, dur: &TickDuration<Self>);
// Provided methods
fn timeout(&mut self, dur: &TickDuration<Self>) -> bool { ... }
fn timeout_with(
&self,
dur: &TickDuration<Self>,
f: impl FnMut() -> bool,
) -> bool { ... }
fn time_left(&mut self, dur: &TickDuration<Self>) -> TickDuration<Self> { ... }
}Expand description
It doesn’t require operation interfaces on TickInstant itself.
Embedded systems can thus implement only the relative time version.
Required Methods§
fn frequency() -> KilohertzU32
fn now() -> Self
Sourcefn elapsed(&mut self) -> TickDuration<Self>
fn elapsed(&mut self) -> TickDuration<Self>
Returns the amount of ticks elapsed since this instant.
Sourcefn move_forward(&mut self, dur: &TickDuration<Self>)
fn move_forward(&mut self, dur: &TickDuration<Self>)
Move the instant forward, but it cannot be in the future.
Provided Methods§
fn timeout(&mut self, dur: &TickDuration<Self>) -> bool
fn timeout_with( &self, dur: &TickDuration<Self>, f: impl FnMut() -> bool, ) -> bool
fn time_left(&mut self, dur: &TickDuration<Self>) -> TickDuration<Self>
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.