diff options
Diffstat (limited to 'tokio/src/lib.rs')
-rw-r--r-- | tokio/src/lib.rs | 81 |
1 files changed, 37 insertions, 44 deletions
diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 81d93c68..d82d58d8 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -70,75 +70,68 @@ //! } //! ``` -#[cfg(all(loom, test))] -macro_rules! thread_local { - ($($tts:tt)+) => { loom::thread_local!{ $($tts)+ } } -} - -macro_rules! ready { - ($e:expr $(,)?) => { - match $e { - std::task::Poll::Ready(t) => t, - std::task::Poll::Pending => return std::task::Poll::Pending, - } - }; -} - -// At the top due to macros -#[cfg(test)] +// macros used internally #[macro_use] -mod tests; +mod macros; -#[cfg(feature = "blocking")] +// Blocking task implementation pub(crate) mod blocking; -#[cfg(feature = "fs")] -pub mod fs; +cfg_fs! { + pub mod fs; +} mod future; pub mod io; -#[cfg(feature = "io-driver")] pub mod net; mod loom; pub mod prelude; -#[cfg(feature = "process")] -#[cfg(not(loom))] -pub mod process; +cfg_process! { + pub mod process; +} pub mod runtime; -#[cfg(feature = "signal")] -#[cfg(not(loom))] -pub mod signal; +cfg_signal! { + pub mod signal; +} -#[cfg(feature = "sync")] -pub mod sync; +cfg_sync! { + pub mod sync; +} +cfg_not_sync! { + mod sync; +} -#[cfg(feature = "rt-core")] -pub mod task; -#[cfg(feature = "rt-core")] -pub use crate::task::spawn; +cfg_rt_core! { + pub mod task; + pub use task::spawn; +} -#[cfg(feature = "time")] -pub mod time; +cfg_time! { + pub mod time; +} -#[cfg(feature = "rt-full")] -mod util; +cfg_rt_threaded! { + mod util; +} -#[cfg(not(test))] // Work around for rust-lang/rust#62127 -#[cfg(feature = "macros")] -#[doc(inline)] -pub use tokio_macros::main; +cfg_macros! { + #[cfg(not(test))] // Work around for rust-lang/rust#62127 + pub use tokio_macros::main; + pub use tokio_macros::test; +} -#[cfg(feature = "macros")] -#[doc(inline)] -pub use tokio_macros::test; +// Tests +#[cfg(test)] +mod tests; +// TODO: rm #[cfg(feature = "io-util")] #[cfg(test)] fn is_unpin<T: Unpin>() {} |