pub struct LabConfig {
pub seed: u64,
pub entropy_seed: u64,
pub worker_count: usize,
pub panic_on_obligation_leak: bool,
pub trace_capacity: usize,
pub futurelock_max_idle_steps: u64,
pub panic_on_futurelock: bool,
pub max_steps: Option<u64>,
pub chaos: Option<ChaosConfig>,
pub replay_recording: Option<RecorderConfig>,
pub auto_advance_time: bool,
}Expand description
Configuration for the lab runtime.
Fields§
§seed: u64Random seed for deterministic scheduling.
entropy_seed: u64Seed for deterministic entropy sources.
By default this matches seed, but can be overridden to decouple
scheduler decisions from entropy generation.
worker_count: usizeNumber of virtual workers to model in the lab scheduler.
This does not spawn threads; it controls deterministic multi-worker simulation. Values less than 1 are clamped to 1.
panic_on_obligation_leak: boolWhether to panic on obligation leaks.
trace_capacity: usizeTrace buffer capacity.
futurelock_max_idle_steps: u64Max lab steps a task may go unpolled while holding obligations.
0 disables the futurelock detector.
panic_on_futurelock: boolWhether to panic when a futurelock is detected.
max_steps: Option<u64>Maximum number of steps before forced termination.
chaos: Option<ChaosConfig>Chaos injection configuration.
When enabled, the runtime will inject faults at various points to stress-test the system’s resilience.
replay_recording: Option<RecorderConfig>Replay recording configuration.
When enabled, the runtime will record all non-determinism sources for later replay.
auto_advance_time: boolWhen true, the runtime auto-advances virtual time to the next timer deadline whenever all tasks are idle (no runnable tasks in scheduler).
This enables “instant timeout testing” — a 24-hour wall-clock scenario completes in <1 second of real time because sleep/timeout deadlines are jumped to instantly rather than waited for.
Implementations§
Source§impl LabConfig
impl LabConfig
Sourcepub fn from_time() -> LabConfig
pub fn from_time() -> LabConfig
Creates a lab configuration from the current time (for quick testing).
Sourcepub const fn panic_on_leak(self, value: bool) -> LabConfig
pub const fn panic_on_leak(self, value: bool) -> LabConfig
Sets whether to panic on obligation leaks.
Sourcepub const fn trace_capacity(self, capacity: usize) -> LabConfig
pub const fn trace_capacity(self, capacity: usize) -> LabConfig
Sets the trace buffer capacity.
Sourcepub const fn worker_count(self, count: usize) -> LabConfig
pub const fn worker_count(self, count: usize) -> LabConfig
Sets the number of virtual workers to model.
Values less than 1 are clamped to 1.
Sourcepub const fn entropy_seed(self, seed: u64) -> LabConfig
pub const fn entropy_seed(self, seed: u64) -> LabConfig
Sets the entropy seed used for capability-based randomness.
Sourcepub const fn futurelock_max_idle_steps(self, steps: u64) -> LabConfig
pub const fn futurelock_max_idle_steps(self, steps: u64) -> LabConfig
Sets the maximum idle steps before the futurelock detector triggers.
Sourcepub const fn panic_on_futurelock(self, value: bool) -> LabConfig
pub const fn panic_on_futurelock(self, value: bool) -> LabConfig
Sets whether to panic when a futurelock is detected.
Sourcepub const fn no_step_limit(self) -> LabConfig
pub const fn no_step_limit(self) -> LabConfig
Disables the step limit.
Sourcepub fn with_chaos(self, config: ChaosConfig) -> LabConfig
pub fn with_chaos(self, config: ChaosConfig) -> LabConfig
Enables chaos injection with the given configuration.
The chaos seed will be derived from the main seed for determinism.
Sourcepub fn with_light_chaos(self) -> LabConfig
pub fn with_light_chaos(self) -> LabConfig
Enables light chaos (suitable for CI).
Sourcepub fn with_heavy_chaos(self) -> LabConfig
pub fn with_heavy_chaos(self) -> LabConfig
Enables heavy chaos (thorough testing).
Sourcepub fn with_replay_recording(self, config: RecorderConfig) -> LabConfig
pub fn with_replay_recording(self, config: RecorderConfig) -> LabConfig
Enables replay recording with the given configuration.
Sourcepub fn with_default_replay_recording(self) -> LabConfig
pub fn with_default_replay_recording(self) -> LabConfig
Enables replay recording with default configuration.
Sourcepub const fn with_auto_advance(self) -> LabConfig
pub const fn with_auto_advance(self) -> LabConfig
Enables automatic time advancement when all tasks are idle.
When enabled, run_with_auto_advance() will jump virtual time to the
next timer deadline whenever the scheduler has no runnable tasks,
enabling instant timeout testing.
Sourcepub fn has_replay_recording(&self) -> bool
pub fn has_replay_recording(&self) -> bool
Returns true if replay recording is enabled.