Skip to content

Commit d7fbe3f

Browse files
committed
implement feedback from stjepan
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent 6b44c01 commit d7fbe3f

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/future/future/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ extension_trait! {
137137
#[doc = r#"
138138
Waits for one of two similarly-typed futures to complete.
139139
140-
Awaits multiple futures simultaneously, returning all results once complete.
140+
Awaits multiple futures simultaneously, returning the output of the
141+
first future that completes.
141142
142143
This function will return a new future which awaits for either one of both
143144
futures to complete. If multiple futures are completed at the same time,
@@ -184,7 +185,10 @@ extension_trait! {
184185
185186
`try_select` is similar to [`select`], but keeps going if a future
186187
resolved to an error until all futures have been resolved. In which case
187-
the error of the `other` future will be returned.
188+
an error is returned.
189+
190+
The ordering of which value is yielded when two futures resolve
191+
simultaneously is intentionally left unspecified.
188192
189193
# Examples
190194

src/future/future/select.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
use std::pin::Pin;
22

3-
use pin_project_lite::pin_project;
43
use async_macros::MaybeDone;
4+
use pin_project_lite::pin_project;
55

6-
use std::future::Future;
76
use crate::task::{Context, Poll};
7+
use std::future::Future;
88

99
pin_project! {
1010
#[allow(missing_docs)]
1111
#[allow(missing_debug_implementations)]
12-
pub struct Select<L, R> where L: Future, R: Future<Output = L::Output> {
12+
pub struct Select<L, R>
13+
where
14+
L: Future,
15+
R: Future<Output = L::Output>
16+
{
1317
#[pin] left: MaybeDone<L>,
1418
#[pin] right: MaybeDone<R>,
1519
}

src/future/future/try_select.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ use std::future::Future;
99
pin_project! {
1010
#[allow(missing_docs)]
1111
#[allow(missing_debug_implementations)]
12-
pub struct TrySelect<L, R> where L: Future, R: Future<Output = L::Output> {
12+
pub struct TrySelect<L, R>
13+
where
14+
L: Future,
15+
R: Future<Output = L::Output>
16+
{
1317
#[pin] left: MaybeDone<L>,
1418
#[pin] right: MaybeDone<R>,
1519
}

0 commit comments

Comments
 (0)