Trait Runtime

Source
pub trait Runtime: Send + 'static {
    type JoinError: JoinError + Send;
    type JoinHandle: Future<Output = Result<(), Self::JoinError>> + Send;

    // Required method
    fn spawn<F>(fut: F) -> Self::JoinHandle
       where F: Future<Output = ()> + Send + 'static;
}
Expand description

Generic Rust async/await runtime

Required Associated Types§

Source

type JoinError: JoinError + Send

The error returned by a JoinHandle after being awaited

Source

type JoinHandle: Future<Output = Result<(), Self::JoinError>> + Send

A future that completes with the result of the spawned task

Required Methods§

Source

fn spawn<F>(fut: F) -> Self::JoinHandle
where F: Future<Output = ()> + Send + 'static,

Spawn a future onto this runtime’s event loop

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§