Skip to main content

Module features

Module features 

Source
Expand description

Opt-in feature catalog. Each submodule is gated by its own Cargo feature flag and adds a specific capability to the base timer wheel without bloating the core build.

See Cargo.toml [features] for the catalog + the README’s “Features” section for per-feature p99 + memory cost + use cases.

Modules§

concurrent
Thread-safe timer wheel: short-mutex wrapper around the base TimerWheel. Schedule + cancel + tick all serialize on a single Mutex because the critical sections are O(1) (or O(slot) on tick - bounded by entries-in-bucket, typically tiny).
cron
Minimal cron-expression parser + recurring scheduler.
deadline_scheduler
Absolute-deadline scheduling layer on top of the base wheel. Callers schedule against wall-clock instants (“fire at t=…”) and drive the scheduler with poll() calls. The wheel itself stays tick-counted; the layer translates between instant deltas and tick deltas via an injected Clock so the workload is deterministic under test.
hierarchical
Hierarchical timer wheel (HHW). Three levels, each a wheel of 64 slots: seconds, minutes (each slot = 64 ticks), hours (each slot = 64*64 ticks). A timer scheduled d ticks out lands on the coarsest wheel whose slot can hold it; on each tick of a higher wheel we cascade its expiring slot’s entries down to the lower wheel re-binned at the residual offset.
metrics
Metered timer wheel: thin wrapper around the base TimerWheel that tracks per-instance counters. Counters are plain u64 fields - no atomics, no locks - because the underlying wheel is itself single-threaded. Pair with the concurrent feature for a thread-safe metered surface (wrap a MeteredTimerWheel inside a mutex of your own).