Skip to content

Commit 2df9428

Browse files
committed
Stabilize Future adapters and IntoFuture
1 parent e812663 commit 2df9428

File tree

2 files changed

+25
-41
lines changed

2 files changed

+25
-41
lines changed

src/future/future/mod.rs

+20-35
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
cfg_unstable! {
2-
mod delay;
3-
mod flatten;
4-
mod race;
5-
mod try_race;
6-
mod join;
7-
mod try_join;
8-
9-
use std::time::Duration;
10-
use delay::DelayFuture;
11-
use flatten::FlattenFuture;
12-
use crate::future::IntoFuture;
13-
use race::Race;
14-
use try_race::TryRace;
15-
use join::Join;
16-
use try_join::TryJoin;
17-
}
18-
19-
cfg_unstable_default! {
20-
use crate::future::timeout::TimeoutFuture;
21-
}
1+
mod delay;
2+
mod flatten;
3+
mod race;
4+
mod try_race;
5+
mod join;
6+
mod try_join;
7+
8+
use std::time::Duration;
9+
use delay::DelayFuture;
10+
use flatten::FlattenFuture;
11+
use race::Race;
12+
use try_race::TryRace;
13+
use join::Join;
14+
use try_join::TryJoin;
15+
16+
#[cfg(feature = "default")]
17+
use crate::future::timeout::TimeoutFuture;
18+
19+
use crate::future::IntoFuture;
2220

2321
extension_trait! {
2422
use core::pin::Pin;
@@ -151,8 +149,6 @@ extension_trait! {
151149
/// dbg!(a.await);
152150
/// # })
153151
/// ```
154-
#[cfg(feature = "unstable")]
155-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
156152
fn delay(self, dur: Duration) -> impl Future<Output = Self::Output> [DelayFuture<Self>]
157153
where
158154
Self: Sized,
@@ -174,8 +170,6 @@ extension_trait! {
174170
/// assert_eq!(future.await, 1);
175171
/// # })
176172
/// ```
177-
#[cfg(feature = "unstable")]
178-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
179173
fn flatten(
180174
self,
181175
) -> impl Future<Output = <Self::Output as IntoFuture>::Output>
@@ -216,8 +210,6 @@ extension_trait! {
216210
# });
217211
```
218212
"#]
219-
#[cfg(feature = "unstable")]
220-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
221213
fn race<F>(
222214
self,
223215
other: F,
@@ -262,8 +254,6 @@ extension_trait! {
262254
# Ok(()) }) }
263255
```
264256
"#]
265-
#[cfg(feature = "unstable")]
266-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
267257
fn try_race<F, T, E>(
268258
self,
269259
other: F
@@ -299,8 +289,6 @@ extension_trait! {
299289
# });
300290
```
301291
"#]
302-
#[cfg(any(feature = "unstable", feature = "docs"))]
303-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
304292
fn join<F>(
305293
self,
306294
other: F
@@ -346,8 +334,6 @@ extension_trait! {
346334
# Ok(()) }) }
347335
```
348336
"#]
349-
#[cfg(any(feature = "unstable", feature = "docs"))]
350-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
351337
fn try_join<F, A, B, E>(
352338
self,
353339
other: F
@@ -385,8 +371,7 @@ extension_trait! {
385371
# });
386372
```
387373
"#]
388-
#[cfg(any(all(feature = "default", feature = "unstable"), feature = "docs"))]
389-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
374+
#[cfg(feature = "default")]
390375
fn timeout(self, dur: Duration) -> impl Future<Output = Self::Output> [TimeoutFuture<Self>]
391376
where Self: Sized
392377
{

src/future/mod.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@
4747
//! [`Future::try_race`]: trait.Future.html#method.try_race
4848
4949
cfg_alloc! {
50+
pub use into_future::IntoFuture;
5051
pub use future::Future;
52+
5153
pub(crate) mod future;
54+
mod into_future;
5255
}
5356

5457
cfg_std! {
@@ -66,9 +69,5 @@ pub use timeout::{timeout, TimeoutError};
6669
#[cfg(any(feature = "unstable", feature = "default"))]
6770
mod timeout;
6871

69-
cfg_unstable! {
70-
pub use into_future::IntoFuture;
71-
pub(crate) use maybe_done::MaybeDone;
72-
mod into_future;
73-
mod maybe_done;
74-
}
72+
pub(crate) use maybe_done::MaybeDone;
73+
mod maybe_done;

0 commit comments

Comments
 (0)