From 1f3a268af492b88d1d94ba60196c314d41983afb Mon Sep 17 00:00:00 2001 From: th4s Date: Fri, 3 Mar 2023 11:36:50 +0100 Subject: [PATCH] Improve comment for `FuturesOrdered` and `FuturesUnordered` Make clear that futures run to completion concurrently instead of parallel. --- futures-util/src/stream/futures_ordered.rs | 5 +++-- futures-util/src/stream/futures_unordered/mod.rs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/futures-util/src/stream/futures_ordered.rs b/futures-util/src/stream/futures_ordered.rs index 618bf1b7b..6a5a4d461 100644 --- a/futures-util/src/stream/futures_ordered.rs +++ b/futures-util/src/stream/futures_ordered.rs @@ -60,8 +60,9 @@ where /// /// This "combinator" is similar to [`FuturesUnordered`], but it imposes a FIFO order /// on top of the set of futures. While futures in the set will race to -/// completion in parallel, results will only be returned in the order their -/// originating futures were added to the queue. +/// completion, results will only be returned in the order their originating futures +/// were added to the queue. Note that the futures run to completion concurrently and +/// not in parallel. /// /// Futures are pushed into this queue and their realized values are yielded in /// order. This structure is optimized to manage a large number of futures. diff --git a/futures-util/src/stream/futures_unordered/mod.rs b/futures-util/src/stream/futures_unordered/mod.rs index 6b5804dc4..dfd6ef4be 100644 --- a/futures-util/src/stream/futures_unordered/mod.rs +++ b/futures-util/src/stream/futures_unordered/mod.rs @@ -39,7 +39,8 @@ use self::ready_to_run_queue::{Dequeue, ReadyToRunQueue}; /// This structure is optimized to manage a large number of futures. /// Futures managed by [`FuturesUnordered`] will only be polled when they /// generate wake-up notifications. This reduces the required amount of work -/// needed to poll large numbers of futures. +/// needed to poll large numbers of futures. Note that the futures run to +/// completion concurrently and not in parallel. /// /// [`FuturesUnordered`] can be filled by [`collect`](Iterator::collect)ing an /// iterator of futures into a [`FuturesUnordered`], or by