pub struct SimContext { /* private fields */ }Expand description
Simulation context provided to workloads.
Wraps all simulation infrastructure into a single, non-generic struct.
For code generic over P: Providers, pass ctx.providers().
Implementations§
Source§impl SimContext
impl SimContext
Sourcepub fn new(
providers: SimProviders,
topology: WorkloadTopology,
state: StateHandle,
) -> Self
pub fn new( providers: SimProviders, topology: WorkloadTopology, state: StateHandle, ) -> Self
Create a new simulation context.
Sourcepub fn providers(&self) -> &SimProviders
pub fn providers(&self) -> &SimProviders
Get the full providers bundle for passing to generic code.
Sourcepub fn network(&self) -> &SimNetworkProvider
pub fn network(&self) -> &SimNetworkProvider
Get the simulated network provider.
Sourcepub fn time(&self) -> &SimTimeProvider
pub fn time(&self) -> &SimTimeProvider
Get the simulated time provider.
Sourcepub fn task(&self) -> &TokioTaskProvider
pub fn task(&self) -> &TokioTaskProvider
Get the task provider.
Sourcepub fn random(&self) -> &SimRandomProvider
pub fn random(&self) -> &SimRandomProvider
Get the seeded random provider.
Sourcepub fn storage(&self) -> &SimStorageProvider
pub fn storage(&self) -> &SimStorageProvider
Get the simulated storage provider.
Sourcepub fn shutdown(&self) -> &CancellationToken
pub fn shutdown(&self) -> &CancellationToken
Get the shutdown cancellation token.
Sourcepub fn state(&self) -> &StateHandle
pub fn state(&self) -> &StateHandle
Get the shared state handle for cross-workload communication.
Auto Trait Implementations§
impl Freeze for SimContext
impl !RefUnwindSafe for SimContext
impl !Send for SimContext
impl !Sync for SimContext
impl Unpin for SimContext
impl UnsafeUnpin for SimContext
impl !UnwindSafe for SimContext
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