pub trait Runtime:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn sleep(duration: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
fn interval(period: Duration) -> Pin<Box<dyn Stream<Item = ()> + Send>>;
fn spawn<F>(future: F)
where F: Future<Output = ()> + Send + 'static;
}Expand description
Runtime abstraction for async operations that need executor-specific features.
Most stream operations are runtime-agnostic and use only futures primitives.
This trait is needed only for:
- Time-based operations (delay, debounce, throttle)
- Spawning background tasks (multicasting, eager evaluation)
Required Methods§
Sourcefn sleep(duration: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn sleep(duration: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>
Sleep for the given duration
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.