Trait Runtime

Source
pub trait Runtime {
    // Required method
    fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
       where F: Future + Send + 'static,
             F::Output: Send + 'static;
}
Expand description

This trait provides a mockable facade for tokio::task::spawn.

Required Methods§

Source

fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,

Spawn a future on a new task managed by an asynchronous runtime, and return a handle that can be used to await completion of that task.

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.

Implementors§

Source§

impl Runtime for TokioRuntime

Source§

impl Runtime for TestRuntime

Available on crate feature test-util only.