[−][src]Trait futures::task::Spawn
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
Spawns tasks that poll futures to completion onto its associated task executor.
The term "task" refers to a kind of lightweight "thread". Task executors are responsible for scheduling the execution of tasks on operating system threads.
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<Sp> Spawn for Box<Sp> where
Sp: Spawn + ?Sized,
[src]
impl<Sp> Spawn for Box<Sp> where
Sp: Spawn + ?Sized,
fn spawn_obj(
&mut self,
future: FutureObj<'static, ()>
) -> Result<(), SpawnObjError>
[src]
fn spawn_obj(
&mut self,
future: 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 Spawn for TokioDefaultSpawner
impl<Ex> Spawn for Executor01As03<Ex> where
Ex: Executor<Compat<UnitError<FutureObj<'static, ()>>, Box<Spawn + 'static + Send>>> + Clone + Send + 'static,impl Spawn for LocalSpawn
impl Spawn for ThreadPool
impl Spawn for LocalSpawn
impl Spawn for ThreadPool
impl Spawn for NoopSpawner
impl Spawn for PanicSpawner
impl Spawn for RecordSpawner
impl<Ex> Spawn03 for Executor01As03<Ex> where
Ex: Executor01<Executor01Future>,
Ex: Clone + Send + 'static,impl Spawn for TokioDefaultSpawner