Skip to main content

Executor

Trait Executor 

Source
pub trait Executor:
    Send
    + Sync
    + 'static {
    // Required methods
    fn spawn(&self, task: Task) -> Box<dyn Execution>;
    fn spawn_blocking(&self, task: BlockingTask) -> Box<dyn Execution>;
}
Expand description

Where runtime work runs, expressed without an executor’s task type.

Required Methods§

Source

fn spawn(&self, task: Task) -> Box<dyn Execution>

Starts an asynchronous task and returns its cancellation handle.

Source

fn spawn_blocking(&self, task: BlockingTask) -> Box<dyn Execution>

Starts blocking work off the application thread.

Implementations on Foreign Types§

Source§

impl Executor for Handle

Source§

fn spawn(&self, task: Task) -> Box<dyn Execution>

Source§

fn spawn_blocking(&self, task: BlockingTask) -> Box<dyn Execution>

Source§

impl<E> Executor for Arc<E>
where E: Executor + ?Sized,

Source§

fn spawn(&self, task: Task) -> Box<dyn Execution>

Source§

fn spawn_blocking(&self, task: BlockingTask) -> Box<dyn Execution>

Implementors§