Trait amiya::Executor[][src]

pub trait Executor: Send + Sync {
    fn spawn<T: Send + 'static>(
        &self,
        future: impl Future<Output = T> + Send + 'static
    );
fn block_on<T>(&self, future: impl Future<Output = T>) -> T; }

Provide you custom async executor to Amiya by impl this trait.

Amiya instance will use it’s block_on method when listen socket and use spawn method to start new request handler task.

See Amiya::executor().

Required methods

fn spawn<T: Send + 'static>(
    &self,
    future: impl Future<Output = T> + Send + 'static
)
[src]

Spawn a new task to your executor, let it run in background.

fn block_on<T>(&self, future: impl Future<Output = T>) -> T[src]

Run a future until complete and returns it’s result.

Loading content...

Implementors

impl Executor for BuiltInExecutor[src]

Loading content...