Skip to content

Commit

Permalink
implement feedback from stjepan
Browse files Browse the repository at this point in the history
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
  • Loading branch information
yoshuawuyts committed Oct 29, 2019
1 parent 6b44c01 commit d7fbe3f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/future/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ extension_trait! {
#[doc = r#"
Waits for one of two similarly-typed futures to complete.
Awaits multiple futures simultaneously, returning all results once complete.
Awaits multiple futures simultaneously, returning the output of the
first future that completes.
This function will return a new future which awaits for either one of both
futures to complete. If multiple futures are completed at the same time,
Expand Down Expand Up @@ -184,7 +185,10 @@ extension_trait! {
`try_select` is similar to [`select`], but keeps going if a future
resolved to an error until all futures have been resolved. In which case
the error of the `other` future will be returned.
an error is returned.
The ordering of which value is yielded when two futures resolve
simultaneously is intentionally left unspecified.
# Examples
Expand Down
10 changes: 7 additions & 3 deletions src/future/future/select.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
use std::pin::Pin;

use pin_project_lite::pin_project;
use async_macros::MaybeDone;
use pin_project_lite::pin_project;

use std::future::Future;
use crate::task::{Context, Poll};
use std::future::Future;

pin_project! {
#[allow(missing_docs)]
#[allow(missing_debug_implementations)]
pub struct Select<L, R> where L: Future, R: Future<Output = L::Output> {
pub struct Select<L, R>
where
L: Future,
R: Future<Output = L::Output>
{
#[pin] left: MaybeDone<L>,
#[pin] right: MaybeDone<R>,
}
Expand Down
6 changes: 5 additions & 1 deletion src/future/future/try_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ use std::future::Future;
pin_project! {
#[allow(missing_docs)]
#[allow(missing_debug_implementations)]
pub struct TrySelect<L, R> where L: Future, R: Future<Output = L::Output> {
pub struct TrySelect<L, R>
where
L: Future,
R: Future<Output = L::Output>
{
#[pin] left: MaybeDone<L>,
#[pin] right: MaybeDone<R>,
}
Expand Down

0 comments on commit d7fbe3f

Please sign in to comment.