pub trait AgnostikExecutor {
// Required methods
fn spawn<F>(&self, future: F) -> JoinHandle<<F as Future>::Output> ⓘ
where F: Future + Send + 'static,
<F as Future>::Output: Send + 'static;
fn spawn_blocking<F, T>(&self, task: F) -> JoinHandle<T> ⓘ
where F: FnOnce() -> T + Send + 'static,
T: Send + 'static;
fn block_on<F>(&self, future: F) -> <F as Future>::Output
where F: Future + Send + 'static,
<F as Future>::Output: Send + 'static;
}Expand description
and wait for a future to finish.
Required Methods§
Sourcefn spawn<F>(&self, future: F) -> JoinHandle<<F as Future>::Output> ⓘ
fn spawn<F>(&self, future: F) -> JoinHandle<<F as Future>::Output> ⓘ
Spawns an asynchronous task using the underlying executor.
Sourcefn spawn_blocking<F, T>(&self, task: F) -> JoinHandle<T> ⓘ
fn spawn_blocking<F, T>(&self, task: F) -> JoinHandle<T> ⓘ
Runs the provided closure on a thread, which can execute blocking tasks asynchronously.
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.