pub trait Executor: Sync + Send {
fn spawn(
self: ArcBorrow<'_, Self>,
lock_class_key: &'static LockClassKey,
future: impl Future + 'static + Send
) -> Result<Arc<dyn Task>>
where
Self: Sized;
fn stop(&self);
}
Expand description
An environment for executing tasks.
Required Methods
sourcefn spawn(
self: ArcBorrow<'_, Self>,
lock_class_key: &'static LockClassKey,
future: impl Future + 'static + Send
) -> Result<Arc<dyn Task>>where
Self: Sized,
fn spawn(
self: ArcBorrow<'_, Self>,
lock_class_key: &'static LockClassKey,
future: impl Future + 'static + Send
) -> Result<Arc<dyn Task>>where
Self: Sized,
Starts executing a task defined by the given future.
Callers are encouraged to use the spawn_task
macro because it automatically defines a
new lock class key.