File tree 3 files changed +18
-6
lines changed
3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,8 @@ extension_trait! {
137
137
#[ doc = r#"
138
138
Waits for one of two similarly-typed futures to complete.
139
139
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.
141
142
142
143
This function will return a new future which awaits for either one of both
143
144
futures to complete. If multiple futures are completed at the same time,
@@ -184,7 +185,10 @@ extension_trait! {
184
185
185
186
`try_select` is similar to [`select`], but keeps going if a future
186
187
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.
188
192
189
193
# Examples
190
194
Original file line number Diff line number Diff line change 1
1
use std:: pin:: Pin ;
2
2
3
- use pin_project_lite:: pin_project;
4
3
use async_macros:: MaybeDone ;
4
+ use pin_project_lite:: pin_project;
5
5
6
- use std:: future:: Future ;
7
6
use crate :: task:: { Context , Poll } ;
7
+ use std:: future:: Future ;
8
8
9
9
pin_project ! {
10
10
#[ allow( missing_docs) ]
11
11
#[ 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
+ {
13
17
#[ pin] left: MaybeDone <L >,
14
18
#[ pin] right: MaybeDone <R >,
15
19
}
Original file line number Diff line number Diff line change @@ -9,7 +9,11 @@ use std::future::Future;
9
9
pin_project ! {
10
10
#[ allow( missing_docs) ]
11
11
#[ 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
+ {
13
17
#[ pin] left: MaybeDone <L >,
14
18
#[ pin] right: MaybeDone <R >,
15
19
}
You can’t perform that action at this time.
0 commit comments