TickInstant

Trait TickInstant 

Source
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§

Source

fn frequency() -> KilohertzU32

Source

fn now() -> Self

Source

fn elapsed(&mut self) -> TickDuration<Self>

Returns the amount of ticks elapsed since this instant.

Source

fn move_forward(&mut self, dur: &TickDuration<Self>)

Move the instant forward, but it cannot be in the future.

Provided Methods§

Source

fn timeout(&mut self, dur: &TickDuration<Self>) -> bool

Source

fn timeout_with( &self, dur: &TickDuration<Self>, f: impl FnMut() -> bool, ) -> bool

Source

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.

Implementors§