Skip to main content

AsyncExecutor

Trait AsyncExecutor 

Source
pub trait AsyncExecutor {
    // Required method
    fn block_on<T>(&self, future: impl Future<Output = T>) -> T;
}
Expand description

Plugin trait used to allow benchmarking on multiple different async runtimes.

Smol and Tokio are supported out of the box, as is the current-thread runner from the Futures crate; it is recommended to use whichever runtime you use in production.

Required Methods§

Source

fn block_on<T>(&self, future: impl Future<Output = T>) -> T

Spawn the given future onto this runtime and block until it’s complete, returning the result.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl AsyncExecutor for &Handle

Available on crate feature async_tokio only.
Source§

fn block_on<T>(&self, future: impl Future<Output = T>) -> T

Source§

impl AsyncExecutor for &Runtime

Available on crate feature async_tokio only.
Source§

fn block_on<T>(&self, future: impl Future<Output = T>) -> T

Source§

impl AsyncExecutor for Handle

Available on crate feature async_tokio only.
Source§

fn block_on<T>(&self, future: impl Future<Output = T>) -> T

Source§

impl AsyncExecutor for Runtime

Available on crate feature async_tokio only.
Source§

fn block_on<T>(&self, future: impl Future<Output = T>) -> T

Implementors§