|
4 | 4 | //!
|
5 | 5 | //! Often it's desireable to await multiple futures as if it was a single
|
6 | 6 | //! future. The `join` family of operations converts multiple futures into a
|
7 |
| -//! single future that returns all of their outputs. The `select` family of |
| 7 | +//! single future that returns all of their outputs. The `race` family of |
8 | 8 | //! operations converts multiple future into a single future that returns the
|
9 | 9 | //! first output.
|
10 | 10 | //!
|
|
13 | 13 | //! | Name | Return signature | When does it return? |
|
14 | 14 | //! | --- | --- | --- |
|
15 | 15 | //! | [`future::join!`] | `(T1, T2)` | Wait for all to complete
|
16 |
| -//! | [`Future::select`] | `T` | Return on first value |
| 16 | +//! | [`Future::race`] | `T` | Return on first value |
17 | 17 | //!
|
18 | 18 | //! ## Fallible Futures Concurrency
|
19 | 19 | //!
|
|
25 | 25 | //! futures are dropped and an error is returned. This is referred to as
|
26 | 26 | //! "short-circuiting".
|
27 | 27 | //!
|
28 |
| -//! In the case of `try_select`, instead of returning the first future that |
| 28 | +//! In the case of `try_race`, instead of returning the first future that |
29 | 29 | //! completes it returns the first future that _successfully_ completes. This
|
30 |
| -//! means `try_select` will keep going until any one of the futures returns |
| 30 | +//! means `try_race` will keep going until any one of the futures returns |
31 | 31 | //! `Ok`, or _all_ futures have returned `Err`.
|
32 | 32 | //!
|
33 | 33 | //! However sometimes it can be useful to use the base variants of the macros
|
|
38 | 38 | //! | --- | --- | --- |
|
39 | 39 | //! | [`future::join!`] | `(Result<T, E>, Result<T, E>)` | Wait for all to complete
|
40 | 40 | //! | [`future::try_join!`] | `Result<(T1, T2), E>` | Return on first `Err`, wait for all to complete
|
41 |
| -//! | [`Future::select`] | `Result<T, E>` | Return on first value |
42 |
| -//! | [`Future::try_select`] | `Result<T, E>` | Return on first `Ok`, reject on last Err |
| 41 | +//! | [`Future::race`] | `Result<T, E>` | Return on first value |
| 42 | +//! | [`Future::try_race`] | `Result<T, E>` | Return on first `Ok`, reject on last Err |
43 | 43 | //!
|
44 | 44 | //! [`future::join!`]: macro.join.html
|
45 | 45 | //! [`future::try_join!`]: macro.try_join.html
|
46 |
| -//! [`Future::select`]: trait.Future.html#method.select |
47 |
| -//! [`Future::try_select`]: trait.Future.html#method.try_select |
| 46 | +//! [`Future::race`]: trait.Future.html#method.race |
| 47 | +//! [`Future::try_race`]: trait.Future.html#method.try_race |
48 | 48 |
|
49 | 49 | #[doc(inline)]
|
50 | 50 | pub use async_macros::{join, try_join};
|
|
0 commit comments