Executor

Trait Executor 

Source
pub trait Executor: Debug {
    // Required method
    fn spawn(
        &self,
        task: Pin<Box<dyn Future<Output = ()>>>,
    ) -> Result<(), Box<dyn Error>>;
}
Expand description

Executor that can start new async tasks.

This trait abstracts the executor interface so that SystemState does not depend on a specific executor implementation.

Note that VirtualSystem does not support multi-threading. The executor should run concurrent tasks on a single thread.

Required Methods§

Source

fn spawn( &self, task: Pin<Box<dyn Future<Output = ()>>>, ) -> Result<(), Box<dyn Error>>

Starts a new async task.

Returns Ok(()) if the task has been started successfully and Err(_) otherwise.

Implementors§