pub struct TimerApi;Expand description
TimerApi Lifecycle timer api façade for macro-expanded entrypoints.
Implementations§
Source§impl TimerApi
impl TimerApi
Sourcepub fn set_lifecycle_timer(
delay: Duration,
label: impl Into<String>,
task: impl Future<Output = ()> + 'static,
) -> TimerHandle
pub fn set_lifecycle_timer( delay: Duration, label: impl Into<String>, task: impl Future<Output = ()> + 'static, ) -> TimerHandle
Public, stable surface for macro-expanded code in downstream crates. Performs no logic; delegates to internal TimerOps.
Sourcepub fn set_guarded(
slot: &'static TimerSlot,
delay: Duration,
label: impl Into<String>,
task: impl Future<Output = ()> + 'static,
) -> bool
pub fn set_guarded( slot: &'static TimerSlot, delay: Duration, label: impl Into<String>, task: impl Future<Output = ()> + 'static, ) -> bool
Schedule a one-shot timer only if the slot is empty. Returns true when a new timer was scheduled.
Sourcepub fn set_interval<F, Fut>(
interval: Duration,
label: impl Into<String>,
task: F,
) -> TimerHandle
pub fn set_interval<F, Fut>( interval: Duration, label: impl Into<String>, task: F, ) -> TimerHandle
Schedule a repeating timer. Task produces a fresh Future on each tick.
Sourcepub fn set_guarded_interval<FInit, InitFut, FTick, TickFut>(
slot: &'static TimerSlot,
init_delay: Duration,
init_label: impl Into<String>,
init_task: FInit,
interval: Duration,
interval_label: impl Into<String>,
tick_task: FTick,
) -> bool
pub fn set_guarded_interval<FInit, InitFut, FTick, TickFut>( slot: &'static TimerSlot, init_delay: Duration, init_label: impl Into<String>, init_task: FInit, interval: Duration, interval_label: impl Into<String>, tick_task: FTick, ) -> bool
Schedule a guarded init timer that installs a repeating interval timer.
Sourcepub fn clear_lifecycle_timer(handle: TimerHandle)
pub fn clear_lifecycle_timer(handle: TimerHandle)
Optional cancellation.
Auto Trait Implementations§
impl Freeze for TimerApi
impl RefUnwindSafe for TimerApi
impl Send for TimerApi
impl Sync for TimerApi
impl Unpin for TimerApi
impl UnwindSafe for TimerApi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more