[−][src]Function async_scoped::scope
pub unsafe fn scope<'a, T: Send + 'static, R, F: FnOnce(&mut Scope<'a, T>) -> R>(
f: F
) -> (Scope<'a, T>, R)
Creates a Scope
to spawn non-'static futures. The
function is called with a block which takes an &mut Scope
. The spawn
method on this arg. can be used to
spawn "local" futures.
Returns
The function returns the created Scope
, and the return
value of the block passed to it. The returned stream and
is expected to be driven completely before being
forgotten. Dropping this stream causes the stream to be
driven while blocking the current thread. The values
returned from the stream are the output of the futures
spawned.
Safety
The returned stream is expected to be run to completion before being forgotten. Dropping it is okay, but blocks the current thread until all spawned futures complete.