From f867373e909ef01596e808fc328add802e8b4cc3 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Wed, 23 Sep 2020 13:59:39 +0200 Subject: [PATCH] Stabilize Future adapters and IntoFuture --- src/future/future/mod.rs | 55 ++++++++++++++------------------------- src/future/into_future.rs | 2 -- src/future/mod.rs | 11 ++++---- 3 files changed, 25 insertions(+), 43 deletions(-) diff --git a/src/future/future/mod.rs b/src/future/future/mod.rs index 24f3fb599..ef8efb2e4 100644 --- a/src/future/future/mod.rs +++ b/src/future/future/mod.rs @@ -1,24 +1,22 @@ -cfg_unstable! { - mod delay; - mod flatten; - mod race; - mod try_race; - mod join; - mod try_join; - - use std::time::Duration; - use delay::DelayFuture; - use flatten::FlattenFuture; - use crate::future::IntoFuture; - use race::Race; - use try_race::TryRace; - use join::Join; - use try_join::TryJoin; -} - -cfg_unstable_default! { - use crate::future::timeout::TimeoutFuture; -} +mod delay; +mod flatten; +mod race; +mod try_race; +mod join; +mod try_join; + +use std::time::Duration; +use delay::DelayFuture; +use flatten::FlattenFuture; +use race::Race; +use try_race::TryRace; +use join::Join; +use try_join::TryJoin; + +#[cfg(feature = "default")] +use crate::future::timeout::TimeoutFuture; + +use crate::future::IntoFuture; extension_trait! { use core::pin::Pin; @@ -151,8 +149,6 @@ extension_trait! { /// dbg!(a.await); /// # }) /// ``` - #[cfg(feature = "unstable")] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn delay(self, dur: Duration) -> impl Future [DelayFuture] where Self: Sized, @@ -174,8 +170,6 @@ extension_trait! { /// assert_eq!(future.await, 1); /// # }) /// ``` - #[cfg(feature = "unstable")] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn flatten( self, ) -> impl Future::Output> @@ -216,8 +210,6 @@ extension_trait! { # }); ``` "#] - #[cfg(feature = "unstable")] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn race( self, other: F, @@ -262,8 +254,6 @@ extension_trait! { # Ok(()) }) } ``` "#] - #[cfg(feature = "unstable")] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn try_race( self, other: F @@ -299,8 +289,6 @@ extension_trait! { # }); ``` "#] - #[cfg(any(feature = "unstable", feature = "docs"))] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn join( self, other: F @@ -346,8 +334,6 @@ extension_trait! { # Ok(()) }) } ``` "#] - #[cfg(any(feature = "unstable", feature = "docs"))] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] fn try_join( self, other: F @@ -385,8 +371,7 @@ extension_trait! { # }); ``` "#] - #[cfg(any(all(feature = "default", feature = "unstable"), feature = "docs"))] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] + #[cfg(feature = "default")] fn timeout(self, dur: Duration) -> impl Future [TimeoutFuture] where Self: Sized { diff --git a/src/future/into_future.rs b/src/future/into_future.rs index 8e5e5e046..e5869150c 100644 --- a/src/future/into_future.rs +++ b/src/future/into_future.rs @@ -30,8 +30,6 @@ use std::future::Future; /// } /// } /// ``` -#[cfg(feature = "unstable")] -#[cfg_attr(feature = "docs", doc(cfg(unstable)))] pub trait IntoFuture { /// The type of value produced on completion. type Output; diff --git a/src/future/mod.rs b/src/future/mod.rs index db0607adb..67dc5f950 100644 --- a/src/future/mod.rs +++ b/src/future/mod.rs @@ -47,8 +47,11 @@ //! [`Future::try_race`]: trait.Future.html#method.try_race cfg_alloc! { + pub use into_future::IntoFuture; pub use future::Future; + pub(crate) mod future; + mod into_future; } cfg_std! { @@ -66,9 +69,5 @@ pub use timeout::{timeout, TimeoutError}; #[cfg(any(feature = "unstable", feature = "default"))] mod timeout; -cfg_unstable! { - pub use into_future::IntoFuture; - pub(crate) use maybe_done::MaybeDone; - mod into_future; - mod maybe_done; -} +pub(crate) use maybe_done::MaybeDone; +mod maybe_done;