pub struct TimerState { /* private fields */ }Expand description
Internal timer state
Stored in the node’s timer collection.
Implementations§
Source§impl TimerState
impl TimerState
Sourcepub fn new_with_fn(
period: TimerDuration,
mode: TimerMode,
callback: fn(),
) -> TimerState
pub fn new_with_fn( period: TimerDuration, mode: TimerMode, callback: fn(), ) -> TimerState
Create a new timer state with function pointer callback
Sourcepub fn new_inert(period: TimerDuration) -> TimerState
pub fn new_inert(period: TimerDuration) -> TimerState
Create an inert timer state
Sourcepub fn period(&self) -> TimerDuration
pub fn period(&self) -> TimerDuration
Get the timer period
Sourcepub fn is_canceled(&self) -> bool
pub fn is_canceled(&self) -> bool
Check if the timer is canceled
Sourcepub fn time_until_next_call(&self) -> TimerDuration
pub fn time_until_next_call(&self) -> TimerDuration
Get time until next call (0 if ready)
Sourcepub fn time_since_last_call(&self) -> TimerDuration
pub fn time_since_last_call(&self) -> TimerDuration
Get time since last call
Sourcepub fn set_callback_fn(&mut self, callback: fn())
pub fn set_callback_fn(&mut self, callback: fn())
Set callback to function pointer
Sourcepub fn set_repeating(&mut self)
pub fn set_repeating(&mut self)
Set timer to repeating mode
Sourcepub fn set_oneshot(&mut self)
pub fn set_oneshot(&mut self)
Set timer to one-shot mode
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimerState
impl RefUnwindSafe for TimerState
impl Send for TimerState
impl Sync for TimerState
impl Unpin for TimerState
impl UnsafeUnpin for TimerState
impl UnwindSafe for TimerState
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