[−][src]Function async_scoped::scope_and_collect
pub unsafe async fn scope_and_collect<'a, T: Send + 'static, R, F: FnOnce(&mut Scope<'a, T>) -> R>(
f: F
) -> (R, Vec<T>)
An asynchronous function that creates a scope and
immediately awaits the stream. The outputs of the
futures are collected as a Vec
and returned along with
the output of the block.
Safety
This function is not completely safe: please see
cancellation_soundness
in tests.rs for a
test-case that suggests how this can lead to invalid
memory access if not dealt with care.
The caller must ensure that the lifetime 'a is valid until the returned future is fully driven. Dropping the future is okay, but blocks the current thread until all spawned futures complete.