diff options
author | Chih-Hung Hsieh <chh@google.com> | 2020-10-25 23:16:22 -0700 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2020-10-25 23:16:22 -0700 |
commit | d45e96efa48a28ad7d831aa7da55f4b6fb9aa22d (patch) | |
tree | aed583542acdae126b0bf494e7a48c8bdbad44cd /src/async_await | |
parent | 10466ab5740c4fd628db8b98d4150f4867d09d38 (diff) | |
download | futures-util-d45e96efa48a28ad7d831aa7da55f4b6fb9aa22d.tar.gz |
Upgrade rust/crates/futures-util to 0.3.7
Test: make all rust crates
Change-Id: I9af426348ba630949d7f3facc0717f439cfe5a7e
Diffstat (limited to 'src/async_await')
-rw-r--r-- | src/async_await/join_mod.rs | 20 | ||||
-rw-r--r-- | src/async_await/mod.rs | 14 | ||||
-rw-r--r-- | src/async_await/pending.rs | 2 | ||||
-rw-r--r-- | src/async_await/poll.rs | 2 | ||||
-rw-r--r-- | src/async_await/select_mod.rs | 10 |
5 files changed, 29 insertions, 19 deletions
diff --git a/src/async_await/join_mod.rs b/src/async_await/join_mod.rs index 909cd3b..4200c08 100644 --- a/src/async_await/join_mod.rs +++ b/src/async_await/join_mod.rs @@ -22,8 +22,13 @@ macro_rules! document_join_macro { /// /// let a = async { 1 }; /// let b = async { 2 }; - /// /// assert_eq!(join!(a, b), (1, 2)); + /// + /// // `join!` is variadic, so you can pass any number of futures + /// let c = async { 3 }; + /// let d = async { 4 }; + /// let e = async { 5 }; + /// assert_eq!(join!(c, d, e), (3, 4, 5)); /// # }); /// ``` $join @@ -48,9 +53,14 @@ macro_rules! document_join_macro { /// use futures::try_join; /// /// let a = async { Ok::<i32, i32>(1) }; - /// let b = async { Ok::<u64, i32>(2) }; - /// + /// let b = async { Ok::<i32, i32>(2) }; /// assert_eq!(try_join!(a, b), Ok((1, 2))); + /// + /// // `try_join!` is variadic, so you can pass any number of futures + /// let c = async { Ok::<i32, i32>(3) }; + /// let d = async { Ok::<i32, i32>(4) }; + /// let e = async { Ok::<i32, i32>(5) }; + /// assert_eq!(try_join!(c, d, e), Ok((3, 4, 5))); /// # }); /// ``` /// @@ -83,7 +93,7 @@ document_join_macro! { #[macro_export] macro_rules! join { ($($tokens:tt)*) => {{ - use $crate::__reexport as __futures_crate; + use $crate::__private as __futures_crate; $crate::join_internal! { $( $tokens )* } @@ -93,7 +103,7 @@ document_join_macro! { #[macro_export] macro_rules! try_join { ($($tokens:tt)*) => {{ - use $crate::__reexport as __futures_crate; + use $crate::__private as __futures_crate; $crate::try_join_internal! { $( $tokens )* } diff --git a/src/async_await/mod.rs b/src/async_await/mod.rs index 69cae13..bdaed95 100644 --- a/src/async_await/mod.rs +++ b/src/async_await/mod.rs @@ -3,37 +3,37 @@ //! This module contains a number of functions and combinators for working //! with `async`/`await` code. -use futures_core::future::Future; -use futures_core::stream::Stream; - -#[doc(hidden)] -pub use futures_core::future::FusedFuture; -#[doc(hidden)] -pub use futures_core::stream::FusedStream; +use futures_core::future::{Future, FusedFuture}; +use futures_core::stream::{Stream, FusedStream}; #[macro_use] mod poll; +#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/64762 pub use self::poll::*; #[macro_use] mod pending; +#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/64762 pub use self::pending::*; // Primary export is a macro #[cfg(feature = "async-await-macro")] mod join_mod; +#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/64762 #[cfg(feature = "async-await-macro")] pub use self::join_mod::*; // Primary export is a macro #[cfg(feature = "async-await-macro")] mod select_mod; +#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/64762 #[cfg(feature = "async-await-macro")] pub use self::select_mod::*; #[cfg(feature = "std")] #[cfg(feature = "async-await-macro")] mod random; +#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/64762 #[cfg(feature = "std")] #[cfg(feature = "async-await-macro")] pub use self::random::*; diff --git a/src/async_await/pending.rs b/src/async_await/pending.rs index b143869..e0cf341 100644 --- a/src/async_await/pending.rs +++ b/src/async_await/pending.rs @@ -15,7 +15,7 @@ use futures_core::task::{Context, Poll}; #[macro_export] macro_rules! pending { () => { - $crate::async_await::pending_once().await + $crate::__private::async_await::pending_once().await } } diff --git a/src/async_await/poll.rs b/src/async_await/poll.rs index dffa94b..ac70a53 100644 --- a/src/async_await/poll.rs +++ b/src/async_await/poll.rs @@ -12,7 +12,7 @@ use futures_core::task::{Context, Poll}; #[macro_export] macro_rules! poll { ($x:expr $(,)?) => { - $crate::async_await::poll($x).await + $crate::__private::async_await::poll($x).await } } diff --git a/src/async_await/select_mod.rs b/src/async_await/select_mod.rs index 0471f09..47eca4d 100644 --- a/src/async_await/select_mod.rs +++ b/src/async_await/select_mod.rs @@ -14,7 +14,7 @@ macro_rules! document_select_macro { /// (e.g. an `async fn` call) instead of a `Future` by name the `Unpin` /// requirement is relaxed, since the macro will pin the resulting `Future` /// on the stack. However the `Future` returned by the expression must - /// still implement `FusedFuture`. This difference is presented + /// still implement `FusedFuture`. /// /// Futures and streams which are not already fused can be fused using the /// `.fuse()` method. Note, though, that fusing a future or stream directly @@ -84,7 +84,7 @@ macro_rules! document_select_macro { /// a_res = async_identity_fn(62).fuse() => a_res + 1, /// b_res = async_identity_fn(13).fuse() => b_res, /// }; - /// assert!(res == 63 || res == 12); + /// assert!(res == 63 || res == 13); /// # }); /// ``` /// @@ -167,7 +167,7 @@ macro_rules! document_select_macro { /// (e.g. an `async fn` call) instead of a `Future` by name the `Unpin` /// requirement is relaxed, since the macro will pin the resulting `Future` /// on the stack. However the `Future` returned by the expression must - /// still implement `FusedFuture`. This difference is presented + /// still implement `FusedFuture`. /// /// Futures and streams which are not already fused can be fused using the /// `.fuse()` method. Note, though, that fusing a future or stream directly @@ -322,7 +322,7 @@ document_select_macro! { #[macro_export] macro_rules! select { ($($tokens:tt)*) => {{ - use $crate::__reexport as __futures_crate; + use $crate::__private as __futures_crate; $crate::select_internal! { $( $tokens )* } @@ -332,7 +332,7 @@ document_select_macro! { #[macro_export] macro_rules! select_biased { ($($tokens:tt)*) => {{ - use $crate::__reexport as __futures_crate; + use $crate::__private as __futures_crate; $crate::select_biased_internal! { $( $tokens )* } |