pub trait Executor {
type Task<T: Send + 'static>: TaskImpl<Output = T> + Send + 'static;
// 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,
) -> Task<Self::Task<T>> ⓘ
where Self: Sized;
fn spawn_blocking<T: Send + 'static, F: FnOnce() -> T + Send + 'static>(
&self,
f: F,
) -> Task<Self::Task<T>> ⓘ
where Self: Sized;
}
Expand description
A common interface for spawning futures on top of an executor
Required Associated Types§
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
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.