Skip to main content

slab_wheel/
lib.rs

1//! A hierarchical timing wheel with stable handles.
2//!
3//! Entries live in a slab; the wheel's slots hold indices into it. Cascading
4//! therefore moves four-byte indices between slots rather than whole entries,
5//! and a handle stays valid for an entry's whole life however many times it
6//! moves, which is what makes cancellation an array index rather than a
7//! lookup.
8//!
9//! The wheel never reads the clock. [`TimingWheel::advance_to`] is told what
10//! time it is, so the whole structure is testable without waiting and a caller
11//! with its own time source can drive it.
12//!
13//! What the wheel decides for itself and what the caller decides is spelled out
14//! in [`Policy`]: the level layout, which way a deadline between two ticks is
15//! rounded, and how much work answering "what is due next" is worth.
16
17#![warn(missing_docs, missing_debug_implementations, unreachable_pub)]
18#![doc = include_str!("../README.md")]
19
20mod mask;
21mod policy;
22mod slab;
23mod wheel;
24
25pub use policy::{CoarseQuery, Millis, Overflow, Policy, Rounding};
26pub use slab::Key;
27pub use wheel::TimingWheel;