pub struct SimProviders { /* private fields */ }Expand description
Simulation providers bundle for deterministic testing.
This struct bundles all four simulation-based providers into a single
instance that implements Providers.
§Usage
SimProviders is typically created by the simulation framework during
workload setup, but can also be manually constructed:
ⓘ
use moonpool_sim::{SimWorld, SimProviders, Providers};
let sim = SimWorld::new();
let providers = SimProviders::new(sim.downgrade(), 42);
// Access individual providers
let network = providers.network();
let time = providers.time();§Implementation Notes
- Uses
SimNetworkProviderfor simulated TCP connections - Uses
SimTimeProviderfor logical/simulated time - Uses
TokioTaskProviderfor task spawning (same as production) - Uses
SimRandomProviderfor seeded deterministic randomness
Implementations§
Source§impl SimProviders
impl SimProviders
Sourcepub fn new(sim: WeakSimWorld, seed: u64) -> Self
pub fn new(sim: WeakSimWorld, seed: u64) -> Self
Create a new simulation providers bundle.
§Arguments
sim- Weak reference to the simulation worldseed- Seed for deterministic random number generation
Trait Implementations§
Source§impl Clone for SimProviders
impl Clone for SimProviders
Source§fn clone(&self) -> SimProviders
fn clone(&self) -> SimProviders
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Providers for SimProviders
impl Providers for SimProviders
Source§type Network = SimNetworkProvider
type Network = SimNetworkProvider
Network provider type for TCP connections and listeners.
Source§type Time = SimTimeProvider
type Time = SimTimeProvider
Time provider type for sleep, timeout, and time queries.
Source§type Task = TokioTaskProvider
type Task = TokioTaskProvider
Task provider type for spawning local tasks.
Source§type Random = SimRandomProvider
type Random = SimRandomProvider
Random provider type for deterministic or real randomness.
Auto Trait Implementations§
impl Freeze for SimProviders
impl !RefUnwindSafe for SimProviders
impl !Send for SimProviders
impl !Sync for SimProviders
impl Unpin for SimProviders
impl !UnwindSafe for SimProviders
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more