pub trait Executor: Sync + Send {
    fn spawn(
        self: RefBorrow<'_, Self>,
        lock_class_key: &'static LockClassKey,
        future: impl Future + 'static + Send
    ) -> Result<Ref<dyn Task>>
        Self: Sized
; fn stop(&self); }
Expand description

An environment for executing tasks.

Required Methods

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.

Stops the executor.

After it is called, attempts to spawn new tasks will result in an error and existing ones won’t be polled anymore.