From 6aa55fde59bea45c1e5e7184782c882a4259813f Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 11:18:09 +0900 Subject: [PATCH] feat: Make the task module no_std --- Cargo.toml | 5 +++-- src/lib.rs | 5 ++++- src/task/mod.rs | 11 +++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fbcf5f4..4492048 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,6 @@ unstable = ["std", "broadcaster", "futures-timer"] attributes = ["async-attributes"] std = [ "crossbeam-utils", - "futures-core", "futures-io", "memchr", "once_cell", @@ -48,7 +47,9 @@ std = [ "slab", "no-std", ] -no-std = [] +no-std = [ + "futures-core", +] [dependencies] async-attributes = { version = "1.1.1", optional = true } diff --git a/src/lib.rs b/src/lib.rs index 237d73f..fc0755d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -241,6 +241,10 @@ pub use async_attributes::{main, test}; #[cfg(feature = "std")] mod macros; +cfg_no_std! { + pub mod task; +} + cfg_std! { pub mod future; pub mod io; @@ -248,7 +252,6 @@ cfg_std! { pub mod prelude; pub mod stream; pub mod sync; - pub mod task; } cfg_default! { diff --git a/src/task/mod.rs b/src/task/mod.rs index f738fca..680e2a5 100644 --- a/src/task/mod.rs +++ b/src/task/mod.rs @@ -117,13 +117,16 @@ //! [`task_local!`]: ../macro.task_local.html //! [`with`]: struct.LocalKey.html#method.with -cfg_std! { +cfg_no_std! { #[doc(inline)] - pub use std::task::{Context, Poll, Waker}; - + pub use core::task::{Context, Poll, Waker}; pub use ready::ready; - pub use yield_now::yield_now; + mod ready; +} + +cfg_std! { + pub use yield_now::yield_now; mod yield_now; }