diff --git a/Cargo.toml b/Cargo.toml index 63897053..af72b6f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,8 +21,10 @@ features = ["docs"] rustdoc-args = ["--cfg", "feature=\"docs\""] [features] +default = ["stable"] docs = ["unstable"] unstable = ["broadcaster"] +stable = [] [dependencies] async-macros = "1.0.0" diff --git a/src/lib.rs b/src/lib.rs index b659c39e..26856887 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,33 +49,46 @@ #![doc(html_logo_url = "https://async.rs/images/logo--hero.svg")] #![recursion_limit = "2048"] -#[macro_use] -mod utils; +/// Declares stable items. +#[doc(hidden)] +macro_rules! cfg_stable { + ($($item:item)*) => { + $( + #[cfg(feature = "stable")] + $item + )* + } +} -pub mod fs; -pub mod future; -pub mod io; -pub mod net; -pub mod os; -pub mod path; -pub mod prelude; -pub mod stream; -pub mod sync; -pub mod task; +cfg_stable! { + #[macro_use] + mod utils; -cfg_unstable! { - pub mod pin; - pub mod process; + pub mod fs; + pub mod future; + pub mod io; + pub mod net; + pub mod os; + pub mod path; + pub mod prelude; + pub mod stream; + pub mod sync; + pub mod task; - mod unit; - mod vec; - mod result; - mod option; - mod string; - mod collections; + cfg_unstable! { + pub mod pin; + pub mod process; - #[doc(inline)] - pub use std::{write, writeln}; -} + mod unit; + mod vec; + mod result; + mod option; + mod string; + mod collections; -mod macros; + #[doc(inline)] + pub use std::{write, writeln}; + } + + mod macros; +} diff --git a/src/prelude.rs b/src/prelude.rs index 91432e0b..3e235cfa 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -23,8 +23,6 @@ pub use crate::io::Seek as _; pub use crate::io::Write as _; #[doc(no_inline)] pub use crate::stream::Stream; -#[doc(no_inline)] -pub use crate::task_local; #[doc(hidden)] pub use crate::future::future::FutureExt as _;