pub fn join_all<I>(iter: I) -> JoinAll<<I as IntoIterator>::Item> ⓘ
Expand description
Creates a future which represents a collection of the outputs of the futures given.
The returned future will drive execution for all of its underlying futures,
collecting the results into a destination Vec<T>
in the same order as they
were provided.
§Examples
use futures_buffered::join_all;
async fn foo(i: u32) -> u32 { i }
let futures = vec![foo(1), foo(2), foo(3)];
assert_eq!(join_all(futures).await, [1, 2, 3]);
§Benchmarks
§Speed
Running 256 100us timers in a single threaded tokio runtime:
futures::future::join_all time: [3.3207 ms 3.3904 ms 3.4552 ms]
futures_buffered::join_all time: [2.6058 ms 2.6616 ms 2.7189 ms]
§Memory usage
Running 256 Ready<i32>
futures.
- count: the number of times alloc/dealloc was called
- alloc: the number of cumulative bytes allocated
- dealloc: the number of cumulative bytes deallocated
futures::future::join_all
count: 512
alloc: 26744 B
dealloc: 26744 B
futures_buffered::join_all
count: 6
alloc: 10312 B
dealloc: 10312 B