Skip to main content

Module timer

Module timer 

Source
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 on native for why this — rather than a hashed timer wheel — was chosen for this pass).
  • tokio (when native is off): a thin wrapper over tokio::time.

Structs§

DtactInterval
A repeating timer. tick() is a plain async method mirroring tokio::time::Interval::tick.
DtactSleep
A future that completes once, after the given Duration has elapsed.
DtactTimeout
Wraps a future with a deadline: resolves to Ok(F::Output) if the inner future completes first, or Err(TimeoutError) if the deadline elapses first.
TimeoutError
Error returned by DtactTimeout when the wrapped future does not complete before the deadline.

Enums§

MissedTickBehavior
Configures how DtactInterval::tick catches up after missing one or more ticks.

Functions§

interval
Convenience free function mirroring tokio::time::interval.
sleep
Convenience free function mirroring tokio::time::sleep.
timeout
Convenience free function mirroring tokio::time::timeout.