Trait hyper::rt::Executor

source ·
pub trait Executor<Fut> {
    // Required method
    fn execute(&self, fut: Fut);
}
Expand description

An executor of futures.

This trait should be implemented for any future.

Example

struct TokioExecutor;

impl<F> Executor<F> for TokioExecutor
where
    F: Future + Send + 'static,
    F::Output: Send + 'static,
{
    fn execute(&self, future: F) {
        tokio::spawn(future);
    }
}

Required Methods§

source

fn execute(&self, fut: Fut)

Place the future into the executor to be run.

Implementors§