Skip to content

Commit 679da06

Browse files
committed
rename select to race
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
1 parent ebe29ac commit 679da06

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/future/future/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
cfg_unstable! {
22
mod delay;
3-
mod select;
4-
mod try_select;
3+
mod race;
4+
mod try_race;
55

66
use std::time::Duration;
77

88
use delay::DelayFuture;
9-
use select::Select;
10-
use try_select::TrySelect;
9+
use race::Race;
10+
use try_race::TryRace;
1111
}
1212

1313
extension_trait! {
@@ -160,30 +160,30 @@ extension_trait! {
160160
let b = future::ready(1u8);
161161
let c = future::ready(2u8);
162162
163-
let f = a.select(b).select(c);
163+
let f = a.race(b).race(c);
164164
assert_eq!(f.await, 1u8);
165165
# });
166166
```
167167
"#]
168168
#[cfg(any(feature = "unstable", feature = "docs"))]
169169
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
170-
fn select<F>(
170+
fn race<F>(
171171
self,
172172
other: F
173-
) -> impl Future<Output = <Self as std::future::Future>::Output> [Select<Self, F>]
173+
) -> impl Future<Output = <Self as std::future::Future>::Output> [Race<Self, F>]
174174
where
175175
Self: std::future::Future + Sized,
176176
F: std::future::Future<Output = <Self as std::future::Future>::Output>,
177177
{
178-
Select::new(self, other)
178+
Race::new(self, other)
179179
}
180180

181181
#[doc = r#"
182182
Waits for one of two similarly-typed fallible futures to complete.
183183
184184
Awaits multiple futures simultaneously, returning all results once complete.
185185
186-
`try_select` is similar to [`select`], but keeps going if a future
186+
`try_race` is similar to [`race`], but keeps going if a future
187187
resolved to an error until all futures have been resolved. In which case
188188
an error is returned.
189189
@@ -203,23 +203,23 @@ extension_trait! {
203203
let b = future::ready(Err(Error::from(ErrorKind::Other)));
204204
let c = future::ready(Ok(1u8));
205205
206-
let f = a.try_select(b).try_select(c);
206+
let f = a.try_race(b).try_race(c);
207207
assert_eq!(f.await?, 1u8);
208208
#
209209
# Ok(()) }) }
210210
```
211211
"#]
212212
#[cfg(any(feature = "unstable", feature = "docs"))]
213213
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
214-
fn try_select<F: std::future::Future, T, E>(
214+
fn try_race<F: std::future::Future, T, E>(
215215
self,
216216
other: F
217-
) -> impl Future<Output = <Self as std::future::Future>::Output> [TrySelect<Self, F>]
217+
) -> impl Future<Output = <Self as std::future::Future>::Output> [TryRace<Self, F>]
218218
where
219219
Self: std::future::Future<Output = Result<T, E>> + Sized,
220220
F: std::future::Future<Output = <Self as std::future::Future>::Output>,
221221
{
222-
TrySelect::new(self, other)
222+
TryRace::new(self, other)
223223
}
224224
}
225225

src/future/future/select.rs renamed to src/future/future/race.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::future::Future;
99
pin_project! {
1010
#[allow(missing_docs)]
1111
#[allow(missing_debug_implementations)]
12-
pub struct Select<L, R>
12+
pub struct Race<L, R>
1313
where
1414
L: Future,
1515
R: Future<Output = L::Output>
@@ -19,7 +19,7 @@ pin_project! {
1919
}
2020
}
2121

22-
impl<L, R> Select<L, R>
22+
impl<L, R> Race<L, R>
2323
where
2424
L: Future,
2525
R: Future<Output = L::Output>,
@@ -32,7 +32,7 @@ where
3232
}
3333
}
3434

35-
impl<L, R> Future for Select<L, R>
35+
impl<L, R> Future for Race<L, R>
3636
where
3737
L: Future,
3838
R: Future<Output = L::Output>,

src/future/future/try_select.rs renamed to src/future/future/try_race.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::future::Future;
99
pin_project! {
1010
#[allow(missing_docs)]
1111
#[allow(missing_debug_implementations)]
12-
pub struct TrySelect<L, R>
12+
pub struct TryRace<L, R>
1313
where
1414
L: Future,
1515
R: Future<Output = L::Output>
@@ -19,7 +19,7 @@ pin_project! {
1919
}
2020
}
2121

22-
impl<L, R> TrySelect<L, R>
22+
impl<L, R> TryRace<L, R>
2323
where
2424
L: Future,
2525
R: Future<Output = L::Output>,
@@ -32,7 +32,7 @@ where
3232
}
3333
}
3434

35-
impl<L, R, T, E> Future for TrySelect<L, R>
35+
impl<L, R, T, E> Future for TryRace<L, R>
3636
where
3737
L: Future<Output = Result<T, E>>,
3838
R: Future<Output = L::Output>,

0 commit comments

Comments
 (0)