Trait avr_oxide::devices::masterclock::DelayEvents
source · pub trait DelayEvents<'c> {
type DelayHandle;
// Required methods
fn after_delay(
&self,
delay: Duration,
bf: Box<dyn DelayCallback + 'c>
) -> Self::DelayHandle;
fn cancel_delay(&self, handle: Self::DelayHandle) -> bool;
}
Expand description
Trait implemented by devices which can run code after a delay has passed.
Required Associated Types§
type DelayHandle
Required Methods§
sourcefn after_delay(
&self,
delay: Duration,
bf: Box<dyn DelayCallback + 'c>
) -> Self::DelayHandle
fn after_delay( &self, delay: Duration, bf: Box<dyn DelayCallback + 'c> ) -> Self::DelayHandle
Call the given callback after /at least/ delay
time has passed.
sourcefn cancel_delay(&self, handle: Self::DelayHandle) -> bool
fn cancel_delay(&self, handle: Self::DelayHandle) -> bool
Cancel a given delay event, if possible. Returns true
if the event
was cancelled, or false
if not (because it either never existed,
or it has already been executed.)