Module sim

Module sim 

Source
Expand description

Core simulation engine for deterministic testing. Core simulation engine for deterministic testing.

This module provides the central SimWorld coordinator that manages time, event processing, and network simulation state.

§Submodules

  • world - Core SimWorld and WeakSimWorld types
  • events - Event types and queue for scheduling
  • state - Network state management (connections, partitions, clogs)
  • wakers - Waker management for async coordination
  • sleep - Sleep future for simulation time
  • rng - Thread-local random number generation

Modules§

events
Event scheduling and processing for the simulation engine.
rng
Thread-local random number generation for simulation.
sleep
Sleep functionality for simulation time.
state
Network state management for simulation.
wakers
Waker management for async coordination.
world
Core simulation world and coordination logic.

Structs§

EventQueue
A priority queue for scheduling events in chronological order.
ScheduledEvent
An event scheduled for execution at a specific simulation time.
SimWorld
The central simulation coordinator that manages time and event processing.
SleepFuture
Future that completes after a specified simulation time duration.
WeakSimWorld
A weak reference to a simulation world.

Enums§

ConnectionStateChange
Connection state changes
Event
Events that can be scheduled in the simulation.
NetworkOperation
Network data operations

Functions§

get_current_sim_seed
Get the current simulation seed.
reset_sim_rng
Reset the thread-local simulation RNG to a fresh state.
set_sim_seed
Set the seed for the thread-local simulation RNG.
sim_random
Generate a random value using the thread-local simulation RNG.
sim_random_f64
Generate a random f64 in the range [0.0, 1.0) using the simulation RNG.
sim_random_range
Generate a random value within a specified range using the thread-local simulation RNG.
sim_random_range_or_default
Generate a random value within the given range, returning the start value if the range is empty.