pub struct DtactInterval { /* private fields */ }Expand description
A repeating timer. tick() is a plain async method mirroring
tokio::time::Interval::tick.
Implementations§
Source§impl DtactInterval
impl DtactInterval
Sourcepub fn new(period: Duration) -> Self
pub fn new(period: Duration) -> Self
Build an interval firing every period, starting one period
from now, with the default MissedTickBehavior::Burst catch-up
policy (change it via Self::set_missed_tick_behavior).
§Panics
Panics if period is zero — a zero-length period has no sensible
tick rate and almost always indicates a caller bug (e.g. an
unintended default Duration::ZERO).
Sourcepub const fn missed_tick_behavior(&self) -> MissedTickBehavior
pub const fn missed_tick_behavior(&self) -> MissedTickBehavior
The current missed-tick catch-up policy.
Sourcepub const fn set_missed_tick_behavior(&mut self, behavior: MissedTickBehavior)
pub const fn set_missed_tick_behavior(&mut self, behavior: MissedTickBehavior)
Change the missed-tick catch-up policy. Takes effect starting
from the next Self::tick call — doesn’t retroactively change
how the interval caught up (or didn’t) from any prior lateness.
Auto Trait Implementations§
impl Freeze for DtactInterval
impl RefUnwindSafe for DtactInterval
impl Send for DtactInterval
impl Sync for DtactInterval
impl Unpin for DtactInterval
impl UnsafeUnpin for DtactInterval
impl UnwindSafe for DtactInterval
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