Trait embedded_timers::clock::Clock
source · pub trait Clock: Sized + Debug {
// Required method
fn try_now(&self) -> Result<Instant, ClockError>;
// Provided methods
fn new_delay(&self) -> Delay<'_, Self>
where Self: Sized { ... }
fn new_timer(&self) -> Timer<'_, Self> { ... }
fn new_timer_running(&self, duration: Duration) -> Timer<'_, Self> { ... }
}Expand description
Implement this trait for your Clock(s). The time is measured since the start of the
application, using a alias to the core::time::Duration type.
Required Methods§
sourcefn try_now(&self) -> Result<Instant, ClockError>
fn try_now(&self) -> Result<Instant, ClockError>
Try to get the time since the application started
Provided Methods§
sourcefn new_delay(&self) -> Delay<'_, Self>where
Self: Sized,
fn new_delay(&self) -> Delay<'_, Self>where
Self: Sized,
Generate a new DelayMS + DelayUS Delay
sourcefn new_timer_running(&self, duration: Duration) -> Timer<'_, Self>
fn new_timer_running(&self, duration: Duration) -> Timer<'_, Self>
Generate and start a new timer
Object Safety§
This trait is not object safe.