Skip to content

Commit e196c16

Browse files
authored
improve try_join_all and FuturesUnordered docs (#2679)
1 parent 09d54eb commit e196c16

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

futures-util/src/future/try_join_all.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ where
7777
/// This function is only available when the `std` or `alloc` feature of this
7878
/// library is activated, and it is activated by default.
7979
///
80+
/// # See Also
81+
///
82+
/// `try_join_all` will switch to the more powerful [`FuturesOrdered`] for performance
83+
/// reasons if the number of futures is large. You may want to look into using it or
84+
/// it's counterpart [`FuturesUnordered`][crate::stream::FuturesUnordered] directly.
85+
///
86+
/// Some examples for additional functionality provided by these are:
87+
///
88+
/// * Adding new futures to the set even after it has been started.
89+
///
90+
/// * Only polling the specific futures that have been woken. In cases where
91+
/// you have a lot of futures this will result in much more efficient polling.
92+
///
93+
///
8094
/// # Examples
8195
///
8296
/// ```

futures-util/src/stream/futures_ordered.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ where
5858

5959
/// An unbounded queue of futures.
6060
///
61-
/// This "combinator" is similar to `FuturesUnordered`, but it imposes an order
61+
/// This "combinator" is similar to [`FuturesUnordered`], but it imposes a FIFO order
6262
/// on top of the set of futures. While futures in the set will race to
6363
/// completion in parallel, results will only be returned in the order their
6464
/// originating futures were added to the queue.

futures-util/src/stream/futures_unordered/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ use self::ready_to_run_queue::{Dequeue, ReadyToRunQueue};
3333

3434
/// A set of futures which may complete in any order.
3535
///
36+
/// See [`FuturesOrdered`](crate::stream::FuturesOrdered) for a version of this
37+
/// type that preserves a FIFO order.
38+
///
3639
/// This structure is optimized to manage a large number of futures.
3740
/// Futures managed by [`FuturesUnordered`] will only be polled when they
3841
/// generate wake-up notifications. This reduces the required amount of work

0 commit comments

Comments
 (0)