Skip to content

Commit a7e0a4c

Browse files
committed
feat: Make the future module no_std
1 parent 9ae21c9 commit a7e0a4c

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/future/future/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ cfg_unstable_default! {
2121
}
2222

2323
extension_trait! {
24-
use std::pin::Pin;
25-
use std::ops::{Deref, DerefMut};
24+
use core::pin::Pin;
25+
use core::ops::{Deref, DerefMut};
2626

2727
use crate::task::{Context, Poll};
2828

@@ -136,7 +136,7 @@ extension_trait! {
136136
137137
[`Future`]: ../future/trait.Future.html
138138
"#]
139-
pub trait FutureExt: std::future::Future {
139+
pub trait FutureExt: core::future::Future {
140140
/// Returns a Future that delays execution for a specified time.
141141
///
142142
/// # Examples

src/future/mod.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,20 @@
4646
//! [`Future::race`]: trait.Future.html#method.race
4747
//! [`Future::try_race`]: trait.Future.html#method.try_race
4848
49-
pub use future::Future;
50-
pub use pending::pending;
51-
pub use poll_fn::poll_fn;
52-
pub use ready::ready;
49+
cfg_no_std! {
50+
pub use future::Future;
51+
pub(crate) mod future;
52+
}
53+
54+
cfg_std! {
55+
pub use pending::pending;
56+
pub use poll_fn::poll_fn;
57+
pub use ready::ready;
5358

54-
pub(crate) mod future;
55-
mod pending;
56-
mod poll_fn;
57-
mod ready;
59+
mod pending;
60+
mod poll_fn;
61+
mod ready;
62+
}
5863

5964
cfg_default! {
6065
pub use timeout::{timeout, TimeoutError};

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ mod macros;
243243

244244
cfg_no_std! {
245245
pub mod task;
246+
pub mod future;
246247
}
247248

248249
cfg_std! {
249-
pub mod future;
250250
pub mod io;
251251
pub mod os;
252252
pub mod prelude;

0 commit comments

Comments
 (0)