# Trait futures::future::Executor [−] [src]

    pub trait Executor<F: Future<Item = (), Error = ()>> {
        fn execute(&self, future: F) -> Result<(), ExecuteError<F>>;
    }

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.

## Implementors

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)