pub trait Executor:
Send
+ Sync
+ 'static {
type AsyncJoin<T: Send + 'static>: AsyncJoin<Item = T>;
type SyncJoin<T: Send + 'static>: SyncJoin<Item = T>;
// Required methods
fn spawn_async<T, F>(future: F) -> Self::AsyncJoin<T>
where T: Send + Sync + 'static,
F: Future<Output = T> + Send + 'static;
fn spawn_sync<T, C>(closure: C) -> Self::SyncJoin<T>
where T: Send + Sync + 'static,
C: FnOnce() -> T + Send + 'static;
}Expand description
Abstract executor for actors
Required Associated Types§
Required Methods§
Sourcefn spawn_async<T, F>(future: F) -> Self::AsyncJoin<T>
fn spawn_async<T, F>(future: F) -> Self::AsyncJoin<T>
Spawns a future onto the executor as a task, returning a handle that can be .awaited for
its result
On async executors, this corresponds to an asynchronous task.
On the Threads executor, this corresponds to a new thread with a single-threaded futures
executor running on it.
Sourcefn spawn_sync<T, C>(closure: C) -> Self::SyncJoin<T>
fn spawn_sync<T, C>(closure: C) -> Self::SyncJoin<T>
Spawns a closure onto its own system thread or blocking task, returning a handle that can be blocked on for its result
On async executors this corresponds to a task on the blocking thread pool, or a new thread
if the executor does not provide a blocking thread pool
On the Threads executor, this corresponds to a new thread.
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.