Trait Executor

trait Executor<Fut>

An executor of futures.

This trait allows Hyper to abstract over async runtimes. Implement this trait for your own type.

Example

# use hyper::rt::Executor;
# use std::future::Future;
#[derive(Clone)]
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

fn execute(self: &Self, fut: Fut)

Place the future into the executor to be run.