Trait criterion::async_executor::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, Tokio and Async-std 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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

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 Runtime

Available on crate feature async_tokio only.
source§

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

Implementors§

source§

impl AsyncExecutor for AsyncStdExecutor

Available on crate feature async_std only.
source§

impl AsyncExecutor for FuturesExecutor

Available on crate feature async_futures only.
source§

impl AsyncExecutor for SmolExecutor

Available on crate feature async_smol only.