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