Expand description
Deterministic simulation testing (DST) re-export module.
Feature-switched re-exports of the tokio primitives that need deterministic
behavior under simulation: time, task, runtime, and signal. Code on
the DST path imports async primitives from here rather than directly from
tokio, so that toggling the simulation feature switches the whole
runtime in one place.
§Feature-switched behavior
The switch requires both the simulation Cargo feature (which enables the
madsim dependency) and RUSTFLAGS="--cfg madsim" (which activates the
simulation re-exports). Without both, all paths route to real tokio.
Only four submodules switch: time, task, runtime, and signal. All
other tokio modules (sync, io, select!, fs, net) use real tokio
unconditionally. Transitive crates (tokio-tungstenite, reqwest, …)
are unaffected.
§Surface
The submodules re-export the following items. A compile-time probe at the
bottom of this file keeps the list and the signatures of the non-generic
free functions consistent across the tokio and madsim routes, and fires on
cargo build (not only cargo test) so breakage surfaces upstream.
time:Duration,Instant,Interval,MissedTickBehavior,Sleep,error(submodule),interval,interval_at,sleep,sleep_until,timeouttask:JoinHandle,spawn,spawn_local,yield_nowruntime:Builder,Handle,Runtimesignal:ctrl_c
§Related seam
Monotonic time (Instant) goes through this module. Wall-clock time
(SystemTime / Unix epoch) is a separate seam: see
nautilus_core::time::duration_since_unix_epoch. Collapsing the two would
lose epoch information and break order and fill timestamps.