[−][src]Function async_scoped::scope
pub unsafe fn scope<'a, T: Send + 'static, R, F: FnOnce(&mut Scope<'a, T>) -> R>(
f: F
) -> (VerifiedStream<'a, FuturesOrdered<JoinHandle<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 returned value implements Stream
and is expected
to be driven completely before being dropped. The values
returned are either the output of the future, or the
stack-trace if it panicked.
Safety
The returned stream is expected to be run to completion.
For safety, the returned stream panics if dropped before
run to completion. It is also marked as !Unpin
to help
mark the parent future which drives it also thus.