pub struct Scope<'scope, 'env: 'scope, T> { /* private fields */ }
multi_threaded
only.Expand description
A TaskPool
scope for running one or more non-'static
futures.
For more information, see TaskPool::scope
.
Implementations§
Source§impl<'scope, 'env, T: Send + 'env> Scope<'scope, 'env, T>
impl<'scope, 'env, T: Send + 'env> Scope<'scope, 'env, T>
Sourcepub fn spawn<Fut: Future<Output = T> + 'scope>(&self, f: Fut)
pub fn spawn<Fut: Future<Output = T> + 'scope>(&self, f: Fut)
Spawns a scoped future onto the executor. The scope must outlive
the provided future. The results of the future will be returned as a part of
TaskPool::scope
’s return value.
On the single threaded task pool, it just calls Scope::spawn_on_scope
.
For more information, see TaskPool::scope
.
Sourcepub fn spawn_on_external<Fut: Future<Output = T> + 'scope>(&self, f: Fut)
pub fn spawn_on_external<Fut: Future<Output = T> + 'scope>(&self, f: Fut)
Spawns a scoped future onto the executor. The scope must outlive
the provided future. The results of the future will be returned as a part of
TaskPool::scope
’s return value.
On the single threaded task pool, it just calls Scope::spawn_on_scope
.
For more information, see TaskPool::scope
.
Sourcepub fn spawn_on_scope<Fut: Future<Output = T> + 'scope>(&self, f: Fut)
pub fn spawn_on_scope<Fut: Future<Output = T> + 'scope>(&self, f: Fut)
Spawns a scoped future that runs on the thread the scope called from. The
scope must outlive the provided future. The results of the future will be
returned as a part of TaskPool::scope
’s return value.
For more information, see TaskPool::scope
.