pub trait Providers: Clone + 'static {
type Network: NetworkProvider + Clone + 'static;
type Time: TimeProvider + Clone + 'static;
type Task: TaskProvider + Clone + 'static;
type Random: RandomProvider + Clone + 'static;
// Required methods
fn network(&self) -> &Self::Network;
fn time(&self) -> &Self::Time;
fn task(&self) -> &Self::Task;
fn random(&self) -> &Self::Random;
}Expand description
Bundle of all provider types for a runtime environment.
This trait consolidates the four provider types (NetworkProvider,
TimeProvider, TaskProvider, RandomProvider) 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 + Clone + 'static
type Network: NetworkProvider + Clone + 'static
Network provider type for TCP connections and listeners.
Sourcetype Time: TimeProvider + Clone + 'static
type Time: TimeProvider + Clone + 'static
Time provider type for sleep, timeout, and time queries.
Sourcetype Task: TaskProvider + Clone + 'static
type Task: TaskProvider + Clone + 'static
Task provider type for spawning local tasks.
Sourcetype Random: RandomProvider + Clone + 'static
type Random: RandomProvider + Clone + 'static
Random provider type for deterministic or real randomness.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.