pub trait Providers:
Clone
+ Send
+ Sync
+ 'static {
type Network: NetworkProvider;
type Time: TimeProvider;
type Task: TaskProvider;
type Random: RandomProvider;
type Storage: StorageProvider;
// Required methods
fn network(&self) -> &Self::Network;
fn time(&self) -> &Self::Time;
fn task(&self) -> &Self::Task;
fn random(&self) -> &Self::Random;
fn storage(&self) -> &Self::Storage;
}Expand description
Bundle of all provider types for a runtime environment.
This trait consolidates the five provider types (NetworkProvider,
TimeProvider, TaskProvider, RandomProvider, StorageProvider)
into a single bundle, reducing type parameter explosion and repetitive
where clauses.
§Implementations
TokioProviders: Production providers using real Tokio runtimeSimProviders(in moonpool-sim): Simulation providers for deterministic testing
§Design
The trait uses associated types to preserve type information at compile time without runtime dispatch. Accessor methods provide convenient access to individual providers while maintaining the bundle.
Required Associated Types§
Sourcetype Network: NetworkProvider
type Network: NetworkProvider
Network provider type for TCP connections and listeners.
Sourcetype Time: TimeProvider
type Time: TimeProvider
Time provider type for sleep, timeout, and time queries.
Sourcetype Task: TaskProvider
type Task: TaskProvider
Task provider type for spawning local tasks.
Sourcetype Random: RandomProvider
type Random: RandomProvider
Random provider type for deterministic or real randomness.
Sourcetype Storage: StorageProvider
type Storage: StorageProvider
Storage provider type for file I/O operations.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".