pub trait Runtime: Send + 'static {
type JoinError: JoinError + Send;
type JoinHandle: Future<Output = Result<(), Self::JoinError>> + Send;
// Required methods
fn spawn<F>(fut: F) -> Self::JoinHandle
where F: Future<Output = ()> + Send + 'static;
fn spawn_blocking<F>(f: F) -> Self::JoinHandle
where F: FnOnce() + Send + 'static;
}Expand description
Generic Rust async/await runtime
Required Associated Types§
Required Methods§
Sourcefn spawn<F>(fut: F) -> Self::JoinHandle
fn spawn<F>(fut: F) -> Self::JoinHandle
Spawn a future onto this runtime’s event loop
Sourcefn spawn_blocking<F>(f: F) -> Self::JoinHandle
fn spawn_blocking<F>(f: F) -> Self::JoinHandle
Spawn a function onto this runtime’s blocking 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.