[−][src]Trait tokio::prelude::future::Executor
A trait for types which can spawn fresh futures.
This trait is typically implemented for "executors", or those types which
can execute futures to completion. Futures passed to Spawn::spawn
typically get turned into a task and are then driven to completion.
On spawn, the executor takes ownership of the future and becomes responsible
to call Future::poll()
whenever a readiness notification is raised.
Required methods
fn execute(&self, future: F) -> Result<(), ExecuteError<F>>
Spawns a future to run on this Executor
, typically in the
"background".
This function will return immediately, and schedule the future future
to run on self
. The details of scheduling and execution are left to
the implementations of Executor
, but this is typically a primary point
for injecting concurrency in a futures-based system. Futures spawned
through this execute
function tend to run concurrently while they're
waiting on events.
Errors
Implementers of this trait are allowed to reject accepting this future as well. This can happen for various reason such as:
- The executor is shut down
- The executor has run out of capacity to execute futures
The decision is left to the caller how to work with this form of error. The error returned transfers ownership of the future back to the caller.
Implementations on Foreign Types
impl<T> Executor<T> for Sender where
T: Future<Item = (), Error = ()> + Send + 'static,
[src]
T: Future<Item = (), Error = ()> + Send + 'static,
fn execute(&self, future: T) -> Result<(), ExecuteError<T>>
[src]
Implementors
impl<F> Executor<F> for tokio::runtime::current_thread::TaskExecutor where
F: Future<Item = (), Error = ()> + 'static,
[src]
F: Future<Item = (), Error = ()> + 'static,
fn execute(&self, future: F) -> Result<(), ExecuteError<F>>
[src]
impl<T> Executor<T> for DefaultExecutor where
T: Future<Item = (), Error = ()> + Send + 'static,
[src]
T: Future<Item = (), Error = ()> + Send + 'static,
fn execute(&self, future: T) -> Result<(), ExecuteError<T>>
[src]
impl<T> Executor<T> for Handle where
T: Future<Item = (), Error = ()> + Send + 'static,
[src]
T: Future<Item = (), Error = ()> + Send + 'static,
fn execute(&self, future: T) -> Result<(), ExecuteError<T>>
[src]
impl<T> Executor<T> for tokio::runtime::TaskExecutor where
T: Future<Item = (), Error = ()> + Send + 'static,
[src]
T: Future<Item = (), Error = ()> + Send + 'static,