Trait futures::task::Executor [−][src]
pub trait Executor { fn spawn_obj(
&mut self,
future: FutureObj<'static, ()>
) -> Result<(), SpawnObjError>; fn status(&self) -> Result<(), SpawnErrorKind> { ... } }
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
A task executor.
Futures are polled until completion by tasks, a kind of lightweight "thread". A task executor is responsible for the creation of these tasks and the coordination of their execution on real operating system threads. In particular, whenever a task signals that it can make further progress via a wake-up notification, it is the responsibility of the task executor to put the task into a queue to continue executing it, i.e. polling the future in it, later.
Required Methods
fn spawn_obj(
&mut self,
future: FutureObj<'static, ()>
) -> Result<(), SpawnObjError>
&mut self,
future: FutureObj<'static, ()>
) -> Result<(), SpawnObjError>
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
Spawns a new task with the given future. The future will be polled until completion.
Errors
The executor may be unable to spawn tasks, either because it has been shut down or is resource-constrained.
Provided Methods
fn status(&self) -> Result<(), SpawnErrorKind>
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
Determines whether the executor is able to spawn new tasks.
Returns
An Ok
return means the executor is likely (but not guaranteed)
to accept a subsequent spawn attempt. Likewise, an Err
return
means that spawn
is likely, but not guaranteed, to yield an error.
Implementations on Foreign Types
impl<E> Executor for Box<E> where
E: Executor + ?Sized,
[src]
impl<E> Executor for Box<E> where
E: Executor + ?Sized,
fn spawn_obj(
&mut self,
task: FutureObj<'static, ()>
) -> Result<(), SpawnObjError>
[src]
fn spawn_obj(
&mut self,
task: FutureObj<'static, ()>
) -> Result<(), SpawnObjError>
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
fn status(&self) -> Result<(), SpawnErrorKind>
[src]
fn status(&self) -> Result<(), SpawnErrorKind>
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
Implementors
impl Executor for LocalExecutor
impl Executor for ThreadPool