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, F: Future<Output = T> + Send + 'static>(
&self,
f: F,
) -> impl Task<T> + 'static
where Self: Sized;
fn spawn_blocking<T: Send + 'static, F: FnOnce() -> T + Send + 'static>(
&self,
f: F,
) -> impl Task<T> + 'static
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