Skip to main content

Runtime

Trait Runtime 

Source
pub trait Runtime {
    // Required methods
    fn spawn<F>(&self, future: F)
       where F: Future<Output = ()> + MaybeSend + 'static;
    fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + MaybeSend;
}
Expand description

The capabilities the harness needs from an async runtime.

Required Methods§

Source

fn spawn<F>(&self, future: F)
where F: Future<Output = ()> + MaybeSend + 'static,

Runs future in the background, detached from the caller.

Source

fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + MaybeSend

Completes after duration has elapsed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§