pub trait Executor {
    fn new() -> Result<Self, Error>;
    fn spawn(&self, future: impl Future<Output = ()> + MaybeSend + 'static);

    fn enter<R>(&self, f: impl FnOnce() -> R) -> R { ... }
Expand description

A type that can run futures.

Required Methods

Creates a new Executor.

Spawns a future in the Executor.

Provided Methods

Runs the given closure inside the Executor.

Some executors, like tokio, require some global state to be in place before creating futures. This method can be leveraged to set up this global state, call a function, restore the state, and obtain the result of the call.

Implementations on Foreign Types