pub trait Dispatch: Sealed {
// Required methods
fn dispatch<F, Fut, R>(&self, task: F) -> VortexResult<JoinHandle<R>>
where F: FnOnce() -> Fut + Send + 'static,
Fut: Future<Output = R> + 'static,
R: Send + 'static;
fn shutdown(self) -> VortexResult<()>;
}
Expand description
A trait for types that may be dispatched.
Required Methods§
sourcefn dispatch<F, Fut, R>(&self, task: F) -> VortexResult<JoinHandle<R>>
fn dispatch<F, Fut, R>(&self, task: F) -> VortexResult<JoinHandle<R>>
Dispatch a new asynchronous task.
The function spawning the task must be Send
as it will be sent to
the driver thread.
The returned Future
will be executed to completion on a single thread,
thus it may be !Send
.
Object Safety§
This trait is not object safe.