Expand description
Async timer primitives: sleep, interval, timeout.
Two backends, selected the same way as crate::fs:
native(default): a single dedicated background thread that maintains a sorted list of pending deadlines and parks until the next one is due (see the module doc onnativefor why this — rather than a hashed timer wheel — was chosen for this pass).tokio(whennativeis off): a thin wrapper overtokio::time.
Structs§
- Dtact
Interval - A repeating timer.
tick()is a plain async method mirroringtokio::time::Interval::tick. - Dtact
Sleep - A future that completes once, after the given
Durationhas elapsed. - Dtact
Timeout - Wraps a future with a deadline: resolves to
Ok(F::Output)if the inner future completes first, orErr(TimeoutError)if the deadline elapses first. - Timeout
Error - Error returned by
DtactTimeoutwhen the wrapped future does not complete before the deadline.
Enums§
- Missed
Tick Behavior - Configures how
DtactInterval::tickcatches up after missing one or more ticks.