pub trait Executor {
// Required methods
fn block_on<T, F: Future<Output = T>>(&self, f: F) -> T
where Self: Sized;
fn spawn<T: Send + 'static>(
&self,
f: impl Future<Output = T> + Send + 'static,
) -> impl Task<T>
where Self: Sized;
fn spawn_blocking<F: FnOnce() -> T + Send + 'static, T: Send + 'static>(
&self,
f: F,
) -> impl Task<T>
where Self: Sized;
}
Expand description
A common interface for spawning futures on top of an executor
Required Methods§
Sourcefn block_on<T, F: Future<Output = T>>(&self, f: F) -> Twhere
Self: Sized,
fn block_on<T, F: Future<Output = T>>(&self, f: F) -> Twhere
Self: Sized,
Block on a future until completion