pub trait TaskRunnerImpl: Debug + 'static {
type Task<T: Send + 'static>: Task<T>;
type LocalTask<T: 'static>: LocalTask<T>;
// Required methods
fn spawn<Fut>(&self, future: Fut) -> Self::Task<Fut::Output>
where Fut: Future + Send + 'static,
Fut::Output: Send + 'static;
fn spawn_blocking<R, F>(&self, func: F) -> Self::Task<R>
where R: Send + 'static,
F: FnOnce() -> R + Send + 'static;
fn block_on<Fut>(&self, future: Fut) -> Fut::Output
where Fut: Future;
}Expand description
A trait that provides a task runner implementation.
Required Associated Types§
Required Methods§
Sourcefn spawn<Fut>(&self, future: Fut) -> Self::Task<Fut::Output>
fn spawn<Fut>(&self, future: Fut) -> Self::Task<Fut::Output>
Spawns a task, possibly in the background.
Returns a task handle to the future.
Sourcefn spawn_blocking<R, F>(&self, func: F) -> Self::Task<R>
fn spawn_blocking<R, F>(&self, func: F) -> Self::Task<R>
Spawns a blocking task in the background.
Returns a task handle to the operation.
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.