pub struct TaskDelayPeriodic { /* private fields */ }
Expand description
Periodic delay timer.
Use inside a polling loop, for example: the loop polls this instance every second.
The method should_run
will return true once 30 seconds or more has elapsed
and it will then reset the timer for that period.
Implementations§
Source§impl TaskDelayPeriodic
impl TaskDelayPeriodic
Sourcepub fn new<D: DurationTicks>(period: D) -> TaskDelayPeriodic
pub fn new<D: DurationTicks>(period: D) -> TaskDelayPeriodic
Create a new timer with the set period.
Sourcepub fn should_run(&mut self) -> bool
pub fn should_run(&mut self) -> bool
Has the set period passed? If it has, resets the internal timer.
Sourcepub fn set_period<D: DurationTicks>(&mut self, period: D)
pub fn set_period<D: DurationTicks>(&mut self, period: D)
Set a new delay period
Auto Trait Implementations§
impl Freeze for TaskDelayPeriodic
impl RefUnwindSafe for TaskDelayPeriodic
impl Send for TaskDelayPeriodic
impl Sync for TaskDelayPeriodic
impl Unpin for TaskDelayPeriodic
impl UnwindSafe for TaskDelayPeriodic
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