pub struct TimerFiring<'ctx> { /* private fields */ }Expand description
One firing of a ThreadpoolTimer, handed to its callback.
The timer is not armed while the callback runs, so re-arming from here is what produces repetition whose delay is measured from the end of this callback – repetition that can never overlap itself.
Implementations§
Source§impl TimerFiring<'_>
impl TimerFiring<'_>
Sourcepub fn rearm_after(&self, delay: Duration)
pub fn rearm_after(&self, delay: Duration)
Arm the timer again to fire once, delay from now.
The arming is applied after this callback returns, so delay is measured
from the end of this firing regardless of where in the callback it is
requested. That is what keeps successive firings strictly sequential: a
callback that re-armed at its start and then ran longer than delay
would otherwise be entered again while still running.
Calling this more than once in a firing keeps the last request.
Sourcepub fn rearm_at(&self, when: SystemTime)
pub fn rearm_at(&self, when: SystemTime)
Arm the timer again to fire once at the wall-clock instant when.
Like TimerFiring::rearm_after, this is applied after the callback
returns. An instant that has already passed by then fires immediately.