diff --git a/Cargo.toml b/Cargo.toml index 38a26aeb05f..d6703e16a5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ members = [ "tokio", "tokio-executor", - "tokio-io", "tokio-macros", "tokio-sync", "tokio-test", diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1dad7b1d600..f9b0d5051bb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,6 +28,7 @@ jobs: tokio: - fs - io + - io-util - net-driver - process - rt-full @@ -49,8 +50,6 @@ jobs: tokio-executor: - current-thread - thread-pool - tokio-io: - - util tokio-sync: - async-traits tokio-macros: [] diff --git a/tokio-io/CHANGELOG.md b/tokio-io/CHANGELOG.md deleted file mode 100644 index 78c6e7a491b..00000000000 --- a/tokio-io/CHANGELOG.md +++ /dev/null @@ -1,97 +0,0 @@ -# 0.2.0-alpha.6 (September 30, 2019) - -- Move to `futures-*-preview 0.3.0-alpha.19` -- Move to `pin-project 0.4` - -# 0.2.0-alpha.5 (September 19, 2019) - -### Added -- bring back generic `split` utility (#1521). -- enable buffering both reads and writes (#1558). - -# 0.2.0-alpha.4 (August 29, 2019) - -- Track tokio release. - -# 0.2.0-alpha.3 (August 28, 2019) - -### Added -- `AsyncReadExt::chain` and `AsyncReadExt::take` (#1484). - -# 0.2.0-alpha.2 (August 17, 2019) - -### Changed -- Update `futures` dependency to 0.3.0-alpha.18. - -### Added -- Implement `AsyncWrite` for `Vec` (#1409). -- Add `BufReader`, `BufWriter` (#1438). - -# 0.2.0-alpha.1 (August 8, 2019) - -### Changed -- Switch to `async`, `await`, and `std::future`. - -# 0.1.12 (March 1, 2019) - -### Added -- Add `unsplit` to join previously split `AsyncRead + AsyncWrite` (#807). - -# 0.1.11 (January 6, 2019) - -* Fix minor error in Decoder::decode API documentation (#797). - -# 0.1.10 (October 23, 2018) - -* Expose inner codec from `Framed` (#686). -* Implement AsyncRead::prepare_uninitialized_buffer for Take and Chain (#678). - -# 0.1.9 (September 27, 2018) - -* Fix bug in `AsyncRead::split()` (#655). -* Fix non-terminating loop in `length_delimited::FramedWrite` (#576). - -# 0.1.8 (August 23, 2018) - -* Documentation improvements - -# 0.1.7 (June 13, 2018) - -* Move `codec::{Encode, Decode, Framed*}` into `tokio-codec` (#353) - -# 0.1.6 (March 09, 2018) - -* Add native endian builder fn to length_delimited (#144) -* Add AsyncRead::poll_read, AsyncWrite::poll_write (#170) - -# 0.1.5 (February 07, 2018) - -* Fix bug in `BytesCodec` and `LinesCodec`. -* Performance improvement to `split`. - -# 0.1.4 (November 10, 2017) - -* Use `FrameTooBig` as length delimited error type (#70). -* Provide `Bytes` and `Lines` codecs (#78). -* Provide `AllowStdIo` wrapper (#76). - -# 0.1.3 (August 14, 2017) - -* Fix bug involving zero sized writes in copy helper (#57). -* Add get / set accessors for length delimited max frame length setting. (#65). -* Add `Framed::into_parts_and_codec` (#59). - -# 0.1.2 (May 23, 2017) - -* Add `from_parts` and `into_parts` to the framing combinators. -* Support passing an initialized buffer to the framing combinators. -* Add `length_adjustment` support to length delimited encoding (#48). - -# 0.1.1 (March 22, 2017) - -* Add some omitted `Self: Sized` bounds. -* Add missing "inner" fns. - -# 0.1.0 (March 15, 2017) - -* Initial release diff --git a/tokio-io/Cargo.toml b/tokio-io/Cargo.toml deleted file mode 100644 index bab907310df..00000000000 --- a/tokio-io/Cargo.toml +++ /dev/null @@ -1,39 +0,0 @@ -[package] -name = "tokio-io" -# When releasing to crates.io: -# - Remove path dependencies -# - Update html_root_url. -# - Update doc url -# - Cargo.toml -# - Update CHANGELOG.md. -# - Create "v0.1.x" git tag. -version = "0.2.0-alpha.6" -edition = "2018" -authors = ["Tokio Contributors "] -license = "MIT" -repository = "https://github.com/tokio-rs/tokio" -homepage = "https://tokio.rs" -documentation = "https://docs.rs/tokio-io/0.2.0-alpha.6/tokio_io" -description = """ -Core I/O primitives for asynchronous I/O in Rust. -""" -categories = ["asynchronous"] - -[features] -util = ["memchr", "pin-project"] - -[dependencies] -bytes = "0.4.7" -log = "0.4" -futures-core-preview = "=0.3.0-alpha.19" -memchr = { version = "2.2", optional = true } -pin-project = { version = "0.4", optional = true } - -[dev-dependencies] -tokio = { version = "=0.2.0-alpha.6", path = "../tokio" } -tokio-test = { version = "=0.2.0-alpha.6", path = "../tokio-test" } - -futures-util-preview = "=0.3.0-alpha.19" - -[package.metadata.docs.rs] -all-features = true diff --git a/tokio-io/LICENSE b/tokio-io/LICENSE deleted file mode 100644 index cdb28b4b56a..00000000000 --- a/tokio-io/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2019 Tokio Contributors - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/tokio-io/README.md b/tokio-io/README.md deleted file mode 100644 index 9aad7a32280..00000000000 --- a/tokio-io/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# tokio-io - -Core I/O abstractions for the Tokio stack. - -## License - -This project is licensed under the [MIT license](LICENSE). - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in Tokio by you, shall be licensed as MIT, without any additional -terms or conditions. diff --git a/tokio-io/src/lib.rs b/tokio-io/src/lib.rs deleted file mode 100644 index 19c0338e539..00000000000 --- a/tokio-io/src/lib.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![doc(html_root_url = "https://docs.rs/tokio-io/0.2.0-alpha.6")] -#![warn( - missing_debug_implementations, - missing_docs, - rust_2018_idioms, - unreachable_pub -)] -#![deny(intra_doc_link_resolution_failure)] -#![doc(test( - no_crate_inject, - attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) -))] - -//! Core I/O traits and combinators when working with Tokio. -//! -//! A description of the high-level I/O combinators can be [found online] in -//! addition to a description of the [low level details]. -//! -//! [found online]: https://tokio.rs/docs/ -//! [low level details]: https://tokio.rs/docs/going-deeper-tokio/core-low-level/ - -mod async_buf_read; -mod async_read; -mod async_write; - -#[cfg(feature = "util")] -mod io; - -#[cfg(feature = "util")] -pub mod split; - -pub use self::async_buf_read::AsyncBufRead; -pub use self::async_read::AsyncRead; -pub use self::async_write::AsyncWrite; - -#[cfg(feature = "util")] -pub use self::io::{ - copy, empty, repeat, sink, AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, BufStream, - BufWriter, Copy, Empty, Repeat, Sink, Take, -}; - -// Re-export `Buf` and `BufMut` since they are part of the API -pub use bytes::{Buf, BufMut}; - -#[cfg(feature = "util")] -#[cfg(test)] -fn is_unpin() {} diff --git a/tokio-test/Cargo.toml b/tokio-test/Cargo.toml index ce9ece11862..b53f9f0bddb 100644 --- a/tokio-test/Cargo.toml +++ b/tokio-test/Cargo.toml @@ -22,9 +22,9 @@ categories = ["asynchronous", "testing"] [dependencies] tokio = { version = "=0.2.0-alpha.6", path = "../tokio" } tokio-executor = { version = "=0.2.0-alpha.6", path = "../tokio-executor" } -tokio-io = { version = "=0.2.0-alpha.6", path = "../tokio-io" } tokio-sync = { version = "=0.2.0-alpha.6", path = "../tokio-sync" } +bytes = "0.4" futures-core-preview = "=0.3.0-alpha.19" pin-convert = "0.1.0" diff --git a/tokio-test/src/io.rs b/tokio-test/src/io.rs index 6610c1dbc38..afd1c423e0f 100644 --- a/tokio-test/src/io.rs +++ b/tokio-test/src/io.rs @@ -16,10 +16,11 @@ //! [`AsyncRead`]: tokio_io::AsyncRead //! [`AsyncWrite`]: tokio_io::AsyncWrite +use tokio::io::{AsyncRead, AsyncWrite}; +use tokio::sync::mpsc; use tokio::timer::{clock, timer, Delay}; -use tokio_io::{AsyncRead, AsyncWrite, Buf}; -use tokio_sync::mpsc; +use bytes::Buf; use futures_core::ready; use std::collections::VecDeque; use std::future::Future; diff --git a/tokio-tls/Cargo.toml b/tokio-tls/Cargo.toml index 611a2bbaea3..2168aa8bab2 100644 --- a/tokio-tls/Cargo.toml +++ b/tokio-tls/Cargo.toml @@ -26,7 +26,7 @@ travis-ci = { repository = "tokio-rs/tokio-tls" } [dependencies] native-tls = "0.2" -tokio-io = { version = "=0.2.0-alpha.6", path = "../tokio-io" } +tokio = { version = "=0.2.0-alpha.6", path = "../tokio", features = ["io-traits"] } [dev-dependencies] tokio = { version = "=0.2.0-alpha.6", path = "../tokio" } diff --git a/tokio-tls/src/lib.rs b/tokio-tls/src/lib.rs index f1d763d78bb..de29b244085 100644 --- a/tokio-tls/src/lib.rs +++ b/tokio-tls/src/lib.rs @@ -28,6 +28,8 @@ //! built. Configuration of TLS parameters is still primarily done through the //! `native-tls` crate. +use tokio::io::{AsyncRead, AsyncWrite}; + use native_tls::{Error, HandshakeError, MidHandshakeTlsStream}; use std::fmt; use std::future::Future; @@ -36,7 +38,6 @@ use std::marker::Unpin; use std::pin::Pin; use std::ptr::null_mut; use std::task::{Context, Poll}; -use tokio_io::{AsyncRead, AsyncWrite}; #[derive(Debug)] struct AllowStd { diff --git a/tokio-util/Cargo.toml b/tokio-util/Cargo.toml index 1ac3a1c877d..1d1c566a0aa 100644 --- a/tokio-util/Cargo.toml +++ b/tokio-util/Cargo.toml @@ -20,7 +20,6 @@ Additional utilities for working with Tokio. categories = ["asynchronous"] [dependencies] -tokio-io = { version = "=0.2.0-alpha.6", path = "../tokio-io" } tokio = { version = "=0.2.0-alpha.6", path = "../tokio" } bytes = "0.4.7" diff --git a/tokio-util/src/codec/decoder.rs b/tokio-util/src/codec/decoder.rs index 720e0b6ef05..dfe5f8ee1a8 100644 --- a/tokio-util/src/codec/decoder.rs +++ b/tokio-util/src/codec/decoder.rs @@ -1,7 +1,7 @@ use crate::codec::encoder::Encoder; use crate::codec::Framed; -use tokio_io::{AsyncRead, AsyncWrite}; +use tokio::io::{AsyncRead, AsyncWrite}; use bytes::BytesMut; use std::io; diff --git a/tokio-util/src/codec/framed.rs b/tokio-util/src/codec/framed.rs index e2eb82cb7d0..8f2317f096a 100644 --- a/tokio-util/src/codec/framed.rs +++ b/tokio-util/src/codec/framed.rs @@ -3,7 +3,7 @@ use crate::codec::encoder::Encoder; use crate::codec::framed_read::{framed_read2, framed_read2_with_buffer, FramedRead2}; use crate::codec::framed_write::{framed_write2, framed_write2_with_buffer, FramedWrite2}; -use tokio_io::{AsyncBufRead, AsyncRead, AsyncWrite}; +use tokio::io::{AsyncBufRead, AsyncRead, AsyncWrite}; use bytes::BytesMut; use futures_core::Stream; diff --git a/tokio-util/src/codec/framed_read.rs b/tokio-util/src/codec/framed_read.rs index 71f22150d2b..6f79cb9a714 100644 --- a/tokio-util/src/codec/framed_read.rs +++ b/tokio-util/src/codec/framed_read.rs @@ -1,7 +1,7 @@ use crate::codec::framed::Fuse; use crate::codec::Decoder; -use tokio_io::AsyncRead; +use tokio::io::AsyncRead; use bytes::BytesMut; use futures_core::Stream; diff --git a/tokio-util/src/codec/framed_write.rs b/tokio-util/src/codec/framed_write.rs index fa8aba175f5..3a95612cf16 100644 --- a/tokio-util/src/codec/framed_write.rs +++ b/tokio-util/src/codec/framed_write.rs @@ -2,7 +2,7 @@ use crate::codec::decoder::Decoder; use crate::codec::encoder::Encoder; use crate::codec::framed::Fuse; -use tokio_io::{AsyncBufRead, AsyncRead, AsyncWrite}; +use tokio::io::{AsyncBufRead, AsyncRead, AsyncWrite}; use bytes::BytesMut; use futures_core::{ready, Stream}; diff --git a/tokio-util/src/codec/length_delimited.rs b/tokio-util/src/codec/length_delimited.rs index 579417a2eb1..df07466eb35 100644 --- a/tokio-util/src/codec/length_delimited.rs +++ b/tokio-util/src/codec/length_delimited.rs @@ -15,7 +15,7 @@ //! byte stream into a stream of frames. //! //! ``` -//! use tokio_io::{AsyncRead, AsyncWrite}; +//! use tokio::io::{AsyncRead, AsyncWrite}; //! use tokio_util::codec::{Framed, LengthDelimitedCodec}; //! //! fn bind_transport(io: T) @@ -78,7 +78,7 @@ //! frame head in the yielded `BytesMut`. //! //! ``` -//! # use tokio_io::AsyncRead; +//! # use tokio::io::AsyncRead; //! # use tokio_util::codec::LengthDelimitedCodec; //! # fn bind_read(io: T) { //! LengthDelimitedCodec::builder() @@ -112,7 +112,7 @@ //! frame head in the yielded `BytesMut`. //! //! ``` -//! # use tokio_io::AsyncRead; +//! # use tokio::io::AsyncRead; //! # use tokio_util::codec::LengthDelimitedCodec; //! # fn bind_read(io: T) { //! LengthDelimitedCodec::builder() @@ -144,7 +144,7 @@ //! **includes** the frame head length. //! //! ``` -//! # use tokio_io::AsyncRead; +//! # use tokio::io::AsyncRead; //! # use tokio_util::codec::LengthDelimitedCodec; //! # fn bind_read(io: T) { //! LengthDelimitedCodec::builder() @@ -178,7 +178,7 @@ //! frame head, including the frame head in the yielded `BytesMut`. //! //! ``` -//! # use tokio_io::AsyncRead; +//! # use tokio::io::AsyncRead; //! # use tokio_util::codec::LengthDelimitedCodec; //! # fn bind_read(io: T) { //! LengthDelimitedCodec::builder() @@ -222,7 +222,7 @@ //! included. //! //! ``` -//! # use tokio_io::AsyncRead; +//! # use tokio::io::AsyncRead; //! # use tokio_util::codec::LengthDelimitedCodec; //! # fn bind_read(io: T) { //! LengthDelimitedCodec::builder() @@ -268,7 +268,7 @@ //! length. //! //! ``` -//! # use tokio_io::AsyncRead; +//! # use tokio::io::AsyncRead; //! # use tokio_util::codec::LengthDelimitedCodec; //! # fn bind_read(io: T) { //! LengthDelimitedCodec::builder() @@ -313,7 +313,7 @@ //! configuration: //! //! ``` -//! # use tokio_io::AsyncWrite; +//! # use tokio::io::AsyncWrite; //! # use tokio_util::codec::LengthDelimitedCodec; //! # fn write_frame(io: T) { //! # let _ = @@ -342,7 +342,7 @@ use crate::codec::{Decoder, Encoder, Framed, FramedRead, FramedWrite}; -use tokio_io::{AsyncRead, AsyncWrite}; +use tokio::io::{AsyncRead, AsyncWrite}; use bytes::{Buf, BufMut, Bytes, BytesMut, IntoBuf}; use std::error::Error as StdError; @@ -605,7 +605,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -649,7 +649,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -673,7 +673,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -697,7 +697,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -731,7 +731,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -755,7 +755,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -778,7 +778,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -799,7 +799,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -823,7 +823,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -865,7 +865,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncRead; + /// # use tokio::io::AsyncRead; /// use tokio_util::codec::LengthDelimitedCodec; /// /// # fn bind_read(io: T) { @@ -890,7 +890,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::AsyncWrite; + /// # use tokio::io::AsyncWrite; /// # use tokio_util::codec::LengthDelimitedCodec; /// # fn write_frame(io: T) { /// LengthDelimitedCodec::builder() @@ -911,7 +911,7 @@ impl Builder { /// # Examples /// /// ``` - /// # use tokio_io::{AsyncRead, AsyncWrite}; + /// # use tokio::io::{AsyncRead, AsyncWrite}; /// # use tokio_util::codec::LengthDelimitedCodec; /// # fn write_frame(io: T) { /// # let _ = diff --git a/tokio-util/tests/framed_write.rs b/tokio-util/tests/framed_write.rs index 90a54af1655..03f0f08b23a 100644 --- a/tokio-util/tests/framed_write.rs +++ b/tokio-util/tests/framed_write.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::AsyncWrite; +use tokio::io::AsyncWrite; use tokio_test::assert_ready; use tokio_test::task::MockTask; use tokio_util::codec::{Encoder, FramedWrite}; diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index 4b87917c9cd..6bbbf2c61b2 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -36,7 +36,9 @@ default = [ ] fs = ["tokio-executor/blocking"] -io = ["tokio-io", "bytes", "iovec"] +io-traits = ["bytes", "iovec"] +io-util = ["io-traits", "pin-project", "memchr"] +io = ["io-traits", "io-util"] macros = ["tokio-macros"] net-full = ["tcp", "udp", "uds"] net-driver = ["mio", "tokio-executor/blocking"] @@ -87,11 +89,12 @@ bytes = { version = "0.4", optional = true } crossbeam-utils = { version = "0.6.0", optional = true } iovec = { version = "0.1", optional = true } lazy_static = { version = "1.0.2", optional = true } +memchr = { version = "2.2", optional = true } mio = { version = "0.6.14", optional = true } num_cpus = { version = "1.8.0", optional = true } +pin-project = { version = "0.4", optional = true } # Backs `DelayQueue` slab = { version = "0.4.1", optional = true } -tokio-io = { version = "=0.2.0-alpha.6", optional = true, features = ["util"], path = "../tokio-io" } tokio-executor = { version = "=0.2.0-alpha.6", optional = true, path = "../tokio-executor" } tokio-macros = { version = "=0.2.0-alpha.6", optional = true, path = "../tokio-macros" } tokio-sync = { version = "=0.2.0-alpha.6", optional = true, path = "../tokio-sync", features = ["async-traits"] } diff --git a/tokio/src/fs/blocking.rs b/tokio/src/fs/blocking.rs index 71b627c10a4..3a9f754c998 100644 --- a/tokio/src/fs/blocking.rs +++ b/tokio/src/fs/blocking.rs @@ -1,6 +1,5 @@ use crate::fs::sys; - -use tokio_io::{AsyncRead, AsyncWrite}; +use crate::io::{AsyncRead, AsyncWrite}; use futures_core::ready; use std::cmp; diff --git a/tokio/src/fs/file.rs b/tokio/src/fs/file.rs index 7c3a6948aa6..aeb5dc28f37 100644 --- a/tokio/src/fs/file.rs +++ b/tokio/src/fs/file.rs @@ -5,8 +5,7 @@ use self::State::*; use crate::fs::blocking::Buf; use crate::fs::{asyncify, sys}; - -use tokio_io::{AsyncRead, AsyncWrite}; +use crate::io::{AsyncRead, AsyncWrite}; use futures_core::ready; use std::fmt; diff --git a/tokio-io/src/async_buf_read.rs b/tokio/src/io/async_buf_read.rs similarity index 99% rename from tokio-io/src/async_buf_read.rs rename to tokio/src/io/async_buf_read.rs index dfac44f3e11..1499bd4fc4d 100644 --- a/tokio-io/src/async_buf_read.rs +++ b/tokio/src/io/async_buf_read.rs @@ -1,4 +1,5 @@ -use crate::AsyncRead; +use crate::io::AsyncRead; + use std::io; use std::ops::DerefMut; use std::pin::Pin; diff --git a/tokio-io/src/async_read.rs b/tokio/src/io/async_read.rs similarity index 98% rename from tokio-io/src/async_read.rs rename to tokio/src/io/async_read.rs index 97ca2b93c36..2bccb17f7a9 100644 --- a/tokio-io/src/async_read.rs +++ b/tokio/src/io/async_read.rs @@ -1,5 +1,3 @@ -//use crate::split::{ReadHalf, WriteHalf}; -//use crate::{framed, split, AsyncWrite}; use bytes::BufMut; use futures_core::ready; use std::io; diff --git a/tokio-io/src/async_write.rs b/tokio/src/io/async_write.rs similarity index 100% rename from tokio-io/src/async_write.rs rename to tokio/src/io/async_write.rs diff --git a/tokio-io/src/io/async_buf_read_ext.rs b/tokio/src/io/io/async_buf_read_ext.rs similarity index 94% rename from tokio-io/src/io/async_buf_read_ext.rs rename to tokio/src/io/io/async_buf_read_ext.rs index 98d5d9b85da..b60f55d54e5 100644 --- a/tokio-io/src/io/async_buf_read_ext.rs +++ b/tokio/src/io/io/async_buf_read_ext.rs @@ -1,8 +1,8 @@ -use crate::io::lines::{lines, Lines}; -use crate::io::read_line::{read_line, ReadLine}; -use crate::io::read_until::{read_until, ReadUntil}; -use crate::io::split::{split, Split}; -use crate::AsyncBufRead; +use crate::io::io::lines::{lines, Lines}; +use crate::io::io::read_line::{read_line, ReadLine}; +use crate::io::io::read_until::{read_until, ReadUntil}; +use crate::io::io::split::{split, Split}; +use crate::io::AsyncBufRead; /// An extension trait which adds utility methods to `AsyncBufRead` types. pub trait AsyncBufReadExt: AsyncBufRead { diff --git a/tokio-io/src/io/async_read_ext.rs b/tokio/src/io/io/async_read_ext.rs similarity index 87% rename from tokio-io/src/io/async_read_ext.rs rename to tokio/src/io/io/async_read_ext.rs index 69265df26ec..c100a71fea4 100644 --- a/tokio-io/src/io/async_read_ext.rs +++ b/tokio/src/io/io/async_read_ext.rs @@ -1,11 +1,11 @@ -use crate::io::chain::{chain, Chain}; -use crate::io::copy::{copy, Copy}; -use crate::io::read::{read, Read}; -use crate::io::read_exact::{read_exact, ReadExact}; -use crate::io::read_to_end::{read_to_end, ReadToEnd}; -use crate::io::read_to_string::{read_to_string, ReadToString}; -use crate::io::take::{take, Take}; -use crate::{AsyncRead, AsyncWrite}; +use crate::io::io::chain::{chain, Chain}; +use crate::io::io::copy::{copy, Copy}; +use crate::io::io::read::{read, Read}; +use crate::io::io::read_exact::{read_exact, ReadExact}; +use crate::io::io::read_to_end::{read_to_end, ReadToEnd}; +use crate::io::io::read_to_string::{read_to_string, ReadToString}; +use crate::io::io::take::{take, Take}; +use crate::io::{AsyncRead, AsyncWrite}; /// An extension trait which adds utility methods to `AsyncRead` types. pub trait AsyncReadExt: AsyncRead { diff --git a/tokio-io/src/io/async_write_ext.rs b/tokio/src/io/io/async_write_ext.rs similarity index 80% rename from tokio-io/src/io/async_write_ext.rs rename to tokio/src/io/io/async_write_ext.rs index 84671a031a7..ea6650d123f 100644 --- a/tokio-io/src/io/async_write_ext.rs +++ b/tokio/src/io/io/async_write_ext.rs @@ -1,8 +1,8 @@ -use crate::io::flush::{flush, Flush}; -use crate::io::shutdown::{shutdown, Shutdown}; -use crate::io::write::{write, Write}; -use crate::io::write_all::{write_all, WriteAll}; -use crate::AsyncWrite; +use crate::io::io::flush::{flush, Flush}; +use crate::io::io::shutdown::{shutdown, Shutdown}; +use crate::io::io::write::{write, Write}; +use crate::io::io::write_all::{write_all, WriteAll}; +use crate::io::AsyncWrite; /// An extension trait which adds utility methods to `AsyncWrite` types. pub trait AsyncWriteExt: AsyncWrite { diff --git a/tokio-io/src/io/buf_reader.rs b/tokio/src/io/io/buf_reader.rs similarity index 98% rename from tokio-io/src/io/buf_reader.rs rename to tokio/src/io/io/buf_reader.rs index 971332bc90e..c9698e1672e 100644 --- a/tokio-io/src/io/buf_reader.rs +++ b/tokio/src/io/io/buf_reader.rs @@ -1,5 +1,6 @@ -use super::DEFAULT_BUF_SIZE; -use crate::{AsyncBufRead, AsyncRead, AsyncWrite}; +use crate::io::io::DEFAULT_BUF_SIZE; +use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite}; + use futures_core::ready; use pin_project::{pin_project, project}; use std::io::{self, Read}; diff --git a/tokio-io/src/io/buf_stream.rs b/tokio/src/io/io/buf_stream.rs similarity index 97% rename from tokio-io/src/io/buf_stream.rs rename to tokio/src/io/io/buf_stream.rs index 4daa4088a33..51b6bbe512e 100644 --- a/tokio-io/src/io/buf_stream.rs +++ b/tokio/src/io/io/buf_stream.rs @@ -1,5 +1,6 @@ -use crate::io::{BufReader, BufWriter}; -use crate::{AsyncBufRead, AsyncRead, AsyncWrite}; +use crate::io::io::{BufReader, BufWriter}; +use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite}; + use pin_project::pin_project; use std::io::{self}; use std::{ diff --git a/tokio-io/src/io/buf_writer.rs b/tokio/src/io/io/buf_writer.rs similarity index 98% rename from tokio-io/src/io/buf_writer.rs rename to tokio/src/io/io/buf_writer.rs index 67c825d2f69..7415c8788d6 100644 --- a/tokio-io/src/io/buf_writer.rs +++ b/tokio/src/io/io/buf_writer.rs @@ -1,5 +1,6 @@ -use super::DEFAULT_BUF_SIZE; -use crate::{AsyncBufRead, AsyncRead, AsyncWrite}; +use crate::io::io::DEFAULT_BUF_SIZE; +use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite}; + use futures_core::ready; use pin_project::{pin_project, project}; use std::fmt; diff --git a/tokio-io/src/io/chain.rs b/tokio/src/io/io/chain.rs similarity index 98% rename from tokio-io/src/io/chain.rs rename to tokio/src/io/io/chain.rs index 99cce4c695b..3f997ff55aa 100644 --- a/tokio-io/src/io/chain.rs +++ b/tokio/src/io/io/chain.rs @@ -1,4 +1,5 @@ -use crate::{AsyncBufRead, AsyncRead}; +use crate::io::{AsyncBufRead, AsyncRead}; + use futures_core::ready; use pin_project::{pin_project, project}; use std::fmt; diff --git a/tokio-io/src/io/copy.rs b/tokio/src/io/io/copy.rs similarity index 98% rename from tokio-io/src/io/copy.rs rename to tokio/src/io/io/copy.rs index 006b45f8004..7af41beb8cd 100644 --- a/tokio-io/src/io/copy.rs +++ b/tokio/src/io/io/copy.rs @@ -1,4 +1,5 @@ -use crate::{AsyncRead, AsyncWrite}; +use crate::io::{AsyncRead, AsyncWrite}; + use futures_core::ready; use std::future::Future; use std::io; diff --git a/tokio-io/src/io/empty.rs b/tokio/src/io/io/empty.rs similarity index 97% rename from tokio-io/src/io/empty.rs rename to tokio/src/io/io/empty.rs index 3717ebc892e..45a1e7593cc 100644 --- a/tokio-io/src/io/empty.rs +++ b/tokio/src/io/io/empty.rs @@ -1,4 +1,5 @@ -use crate::{AsyncBufRead, AsyncRead}; +use crate::io::{AsyncBufRead, AsyncRead}; + use std::fmt; use std::io; use std::pin::Pin; diff --git a/tokio-io/src/io/flush.rs b/tokio/src/io/io/flush.rs similarity index 96% rename from tokio-io/src/io/flush.rs rename to tokio/src/io/io/flush.rs index b7b8f2a031b..61253ab5ba2 100644 --- a/tokio-io/src/io/flush.rs +++ b/tokio/src/io/io/flush.rs @@ -1,4 +1,5 @@ -use crate::AsyncWrite; +use crate::io::AsyncWrite; + use std::future::Future; use std::io; use std::pin::Pin; diff --git a/tokio-io/src/io/lines.rs b/tokio/src/io/io/lines.rs similarity index 94% rename from tokio-io/src/io/lines.rs rename to tokio/src/io/io/lines.rs index 36411936787..fe95e2a0fa6 100644 --- a/tokio-io/src/io/lines.rs +++ b/tokio/src/io/io/lines.rs @@ -1,5 +1,5 @@ -use super::read_line::read_line_internal; -use crate::AsyncBufRead; +use crate::io::io::read_line::read_line_internal; +use crate::io::AsyncBufRead; use futures_core::{ready, Stream}; use pin_project::{pin_project, project}; diff --git a/tokio-io/src/io/mod.rs b/tokio/src/io/io/mod.rs similarity index 100% rename from tokio-io/src/io/mod.rs rename to tokio/src/io/io/mod.rs diff --git a/tokio-io/src/io/read.rs b/tokio/src/io/io/read.rs similarity index 97% rename from tokio-io/src/io/read.rs rename to tokio/src/io/io/read.rs index fa3b80416a5..1fb8c8c8457 100644 --- a/tokio-io/src/io/read.rs +++ b/tokio/src/io/io/read.rs @@ -1,4 +1,5 @@ -use crate::AsyncRead; +use crate::io::AsyncRead; + use std::future::Future; use std::io; use std::marker::Unpin; diff --git a/tokio-io/src/io/read_exact.rs b/tokio/src/io/io/read_exact.rs similarity index 98% rename from tokio-io/src/io/read_exact.rs rename to tokio/src/io/io/read_exact.rs index 43b0ef6df12..fc57594a25a 100644 --- a/tokio-io/src/io/read_exact.rs +++ b/tokio/src/io/io/read_exact.rs @@ -1,4 +1,5 @@ -use crate::AsyncRead; +use crate::io::AsyncRead; + use futures_core::ready; use std::future::Future; use std::io; diff --git a/tokio-io/src/io/read_line.rs b/tokio/src/io/io/read_line.rs similarity index 96% rename from tokio-io/src/io/read_line.rs rename to tokio/src/io/io/read_line.rs index b1d7a511c9d..b5839a247ad 100644 --- a/tokio-io/src/io/read_line.rs +++ b/tokio/src/io/io/read_line.rs @@ -1,5 +1,6 @@ -use super::read_until::read_until_internal; -use crate::AsyncBufRead; +use crate::io::io::read_until::read_until_internal; +use crate::io::AsyncBufRead; + use futures_core::ready; use std::future::Future; use std::io; diff --git a/tokio-io/src/io/read_to_end.rs b/tokio/src/io/io/read_to_end.rs similarity index 99% rename from tokio-io/src/io/read_to_end.rs rename to tokio/src/io/io/read_to_end.rs index 8c68b8b48ae..32b2eff3357 100644 --- a/tokio-io/src/io/read_to_end.rs +++ b/tokio/src/io/io/read_to_end.rs @@ -1,4 +1,5 @@ -use crate::AsyncRead; +use crate::io::AsyncRead; + use futures_core::ready; use std::future::Future; use std::io; diff --git a/tokio-io/src/io/read_to_string.rs b/tokio/src/io/io/read_to_string.rs similarity index 96% rename from tokio-io/src/io/read_to_string.rs rename to tokio/src/io/io/read_to_string.rs index d53b402b1dc..55b2a9a7b29 100644 --- a/tokio-io/src/io/read_to_string.rs +++ b/tokio/src/io/io/read_to_string.rs @@ -1,5 +1,6 @@ -use super::read_to_end::read_to_end_internal; -use crate::AsyncRead; +use crate::io::io::read_to_end::read_to_end_internal; +use crate::io::AsyncRead; + use futures_core::ready; use std::future::Future; use std::pin::Pin; diff --git a/tokio-io/src/io/read_until.rs b/tokio/src/io/io/read_until.rs similarity index 98% rename from tokio-io/src/io/read_until.rs rename to tokio/src/io/io/read_until.rs index cc3fe025930..82264c84ab6 100644 --- a/tokio-io/src/io/read_until.rs +++ b/tokio/src/io/io/read_until.rs @@ -1,4 +1,5 @@ -use crate::AsyncBufRead; +use crate::io::AsyncBufRead; + use futures_core::ready; use std::future::Future; use std::io; diff --git a/tokio-io/src/io/repeat.rs b/tokio/src/io/io/repeat.rs similarity index 98% rename from tokio-io/src/io/repeat.rs rename to tokio/src/io/io/repeat.rs index 79a1df171eb..3f37d6eae50 100644 --- a/tokio-io/src/io/repeat.rs +++ b/tokio/src/io/io/repeat.rs @@ -1,4 +1,4 @@ -use crate::AsyncRead; +use crate::io::AsyncRead; use std::io; use std::pin::Pin; diff --git a/tokio-io/src/io/shutdown.rs b/tokio/src/io/io/shutdown.rs similarity index 97% rename from tokio-io/src/io/shutdown.rs rename to tokio/src/io/io/shutdown.rs index 8f4e372d578..ee7f4592fd8 100644 --- a/tokio-io/src/io/shutdown.rs +++ b/tokio/src/io/io/shutdown.rs @@ -1,4 +1,5 @@ -use crate::AsyncWrite; +use crate::io::AsyncWrite; + use std::future::Future; use std::io; use std::pin::Pin; diff --git a/tokio-io/src/io/sink.rs b/tokio/src/io/io/sink.rs similarity index 98% rename from tokio-io/src/io/sink.rs rename to tokio/src/io/io/sink.rs index 75ade214564..eefdb9ebc0e 100644 --- a/tokio-io/src/io/sink.rs +++ b/tokio/src/io/io/sink.rs @@ -1,4 +1,5 @@ -use crate::AsyncWrite; +use crate::io::AsyncWrite; + use std::fmt; use std::io; use std::pin::Pin; diff --git a/tokio-io/src/io/split.rs b/tokio/src/io/io/split.rs similarity index 94% rename from tokio-io/src/io/split.rs rename to tokio/src/io/io/split.rs index bc69e1ca9a2..c3d7430eb22 100644 --- a/tokio-io/src/io/split.rs +++ b/tokio/src/io/io/split.rs @@ -1,5 +1,5 @@ -use super::read_until::read_until_internal; -use crate::AsyncBufRead; +use crate::io::io::read_until::read_until_internal; +use crate::io::AsyncBufRead; use futures_core::{ready, Stream}; use pin_project::{pin_project, project}; diff --git a/tokio-io/src/io/take.rs b/tokio/src/io/io/take.rs similarity index 98% rename from tokio-io/src/io/take.rs rename to tokio/src/io/io/take.rs index 033323578be..255f835302f 100644 --- a/tokio-io/src/io/take.rs +++ b/tokio/src/io/io/take.rs @@ -1,4 +1,5 @@ -use crate::{AsyncBufRead, AsyncRead}; +use crate::io::{AsyncBufRead, AsyncRead}; + use futures_core::ready; use pin_project::{pin_project, project}; use std::pin::Pin; diff --git a/tokio-io/src/io/write.rs b/tokio/src/io/io/write.rs similarity index 97% rename from tokio-io/src/io/write.rs rename to tokio/src/io/io/write.rs index a208b033fb7..42e59848b0f 100644 --- a/tokio-io/src/io/write.rs +++ b/tokio/src/io/io/write.rs @@ -1,4 +1,5 @@ -use crate::AsyncWrite; +use crate::io::AsyncWrite; + use std::future::Future; use std::io; use std::pin::Pin; diff --git a/tokio-io/src/io/write_all.rs b/tokio/src/io/io/write_all.rs similarity index 97% rename from tokio-io/src/io/write_all.rs rename to tokio/src/io/io/write_all.rs index 3434e450423..78da8ecdd3f 100644 --- a/tokio-io/src/io/write_all.rs +++ b/tokio/src/io/io/write_all.rs @@ -1,4 +1,5 @@ -use crate::AsyncWrite; +use crate::io::AsyncWrite; + use futures_core::ready; use std::future::Future; use std::io; diff --git a/tokio/src/io/mod.rs b/tokio/src/io/mod.rs index 0553c891697..57faad570ee 100644 --- a/tokio/src/io/mod.rs +++ b/tokio/src/io/mod.rs @@ -36,6 +36,28 @@ //! [`ErrorKind`]: enum.ErrorKind.html //! [`Result`]: type.Result.html +mod async_buf_read; +pub use self::async_buf_read::AsyncBufRead; + +mod async_read; +pub use self::async_read::AsyncRead; + +mod async_write; +pub use self::async_write::AsyncWrite; + +#[cfg(feature = "io-util")] +mod io; +#[cfg(feature = "io-util")] +pub use self::io::{ + copy, empty, repeat, sink, AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, BufStream, + BufWriter, Copy, Empty, Repeat, Sink, Take, +}; + +#[cfg(feature = "io-util")] +pub mod split; +#[cfg(feature = "io-util")] +pub use self::split::split; + // TODO: These should not be guarded by `fs` #[cfg(feature = "fs")] @@ -53,12 +75,7 @@ mod stdout; #[cfg(feature = "fs")] pub use self::stdout::{stdout, Stdout}; -pub use tokio_io::split::split; -pub use tokio_io::{ - empty, repeat, sink, AsyncBufRead, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncWrite, - AsyncWriteExt, BufReader, BufWriter, Empty, Repeat, Sink, Take, -}; - // Re-export io::Error so that users don't have to deal // with conflicts when `use`ing `tokio::io` and `std::io`. +#[cfg(feature = "io-util")] pub use std::io::{Error, ErrorKind, Result}; diff --git a/tokio-io/src/split.rs b/tokio/src/io/split.rs similarity index 99% rename from tokio-io/src/split.rs rename to tokio/src/io/split.rs index 0fd0ebbcf37..28c7d5d4d2a 100644 --- a/tokio-io/src/split.rs +++ b/tokio/src/io/split.rs @@ -4,7 +4,7 @@ //! To restore this read/write object from its `split::ReadHalf` and //! `split::WriteHalf` use `unsplit`. -use crate::{AsyncRead, AsyncWrite}; +use crate::io::{AsyncRead, AsyncWrite}; use bytes::{Buf, BufMut}; use futures_core::ready; diff --git a/tokio/src/io/stderr.rs b/tokio/src/io/stderr.rs index 617b5d1e32f..2b9c4d71572 100644 --- a/tokio/src/io/stderr.rs +++ b/tokio/src/io/stderr.rs @@ -1,6 +1,5 @@ use crate::fs::blocking::Blocking; - -use tokio_io::AsyncWrite; +use crate::io::AsyncWrite; use std::io; use std::pin::Pin; diff --git a/tokio/src/io/stdin.rs b/tokio/src/io/stdin.rs index 7c85abdad5d..f85bbddc052 100644 --- a/tokio/src/io/stdin.rs +++ b/tokio/src/io/stdin.rs @@ -1,6 +1,5 @@ use crate::fs::blocking::Blocking; - -use tokio_io::AsyncRead; +use crate::io::AsyncRead; use std::io; use std::pin::Pin; diff --git a/tokio/src/io/stdout.rs b/tokio/src/io/stdout.rs index 39da06af672..ea96dd33e4f 100644 --- a/tokio/src/io/stdout.rs +++ b/tokio/src/io/stdout.rs @@ -1,6 +1,5 @@ use crate::fs::blocking::Blocking; - -use tokio_io::AsyncWrite; +use crate::io::AsyncWrite; use std::io; use std::pin::Pin; diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 814f2a59b21..249bf47a5f8 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -129,3 +129,7 @@ if_runtime! { #[doc(inline)] pub use tokio_macros::test; } + +#[cfg(feature = "io-util")] +#[cfg(test)] +fn is_unpin() {} diff --git a/tokio/src/net/tcp/split.rs b/tokio/src/net/tcp/split.rs index db937267d02..07c7c3ffae9 100644 --- a/tokio/src/net/tcp/split.rs +++ b/tokio/src/net/tcp/split.rs @@ -8,9 +8,8 @@ //! split has no associated overhead and enforces all invariants at the type //! level. -use super::TcpStream; - -use tokio_io::{AsyncRead, AsyncWrite}; +use crate::io::{AsyncRead, AsyncWrite}; +use crate::net::TcpStream; use bytes::{Buf, BufMut}; use std::io; diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index a3ac18a9119..09629cfb8cc 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -1,9 +1,8 @@ +use crate::io::{AsyncRead, AsyncWrite}; use crate::net::tcp::split::{split, ReadHalf, WriteHalf}; use crate::net::util::PollEvented; use crate::net::ToSocketAddrs; -use tokio_io::{AsyncRead, AsyncWrite}; - use bytes::{Buf, BufMut}; use futures_core::ready; use futures_util::future::poll_fn; diff --git a/tokio/src/net/unix/split.rs b/tokio/src/net/unix/split.rs index 1f0e9c1d267..f9bb7e9a3c4 100644 --- a/tokio/src/net/unix/split.rs +++ b/tokio/src/net/unix/split.rs @@ -8,9 +8,8 @@ //! split has no associated overhead and enforces all invariants at the type //! level. -use super::UnixStream; - -use tokio_io::{AsyncRead, AsyncWrite}; +use crate::io::{AsyncRead, AsyncWrite}; +use crate::net::UnixStream; use bytes::{Buf, BufMut}; use std::io; diff --git a/tokio/src/net/unix/stream.rs b/tokio/src/net/unix/stream.rs index f2ce7a1f74e..2ea8b6c70ca 100644 --- a/tokio/src/net/unix/stream.rs +++ b/tokio/src/net/unix/stream.rs @@ -1,9 +1,8 @@ +use crate::io::{AsyncRead, AsyncWrite}; use crate::net::unix::split::{split, ReadHalf, WriteHalf}; use crate::net::unix::ucred::{self, UCred}; use crate::net::util::PollEvented; -use tokio_io::{AsyncRead, AsyncWrite}; - use bytes::{Buf, BufMut}; use futures_core::ready; use futures_util::future::poll_fn; diff --git a/tokio/src/net/util/poll_evented.rs b/tokio/src/net/util/poll_evented.rs index c1e95c35981..619a35ad5c0 100644 --- a/tokio/src/net/util/poll_evented.rs +++ b/tokio/src/net/util/poll_evented.rs @@ -1,9 +1,7 @@ +use crate::io::{AsyncRead, AsyncWrite}; use crate::net::driver::{platform, Registration}; -use tokio_io::{AsyncRead, AsyncWrite}; - use futures_core::ready; -use mio; use mio::event::Evented; use std::fmt; use std::io::{self, Read, Write}; diff --git a/tokio/src/prelude.rs b/tokio/src/prelude.rs index 20a36260206..26144c4d170 100644 --- a/tokio/src/prelude.rs +++ b/tokio/src/prelude.rs @@ -27,7 +27,7 @@ pub use futures_util::sink::SinkExt as _; pub use futures_util::stream::StreamExt as _; #[cfg(feature = "io")] -pub use tokio_io::{AsyncBufRead, AsyncRead, AsyncWrite}; +pub use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite}; #[cfg(feature = "io")] #[doc(no_inline)] -pub use tokio_io::{AsyncBufReadExt as _, AsyncReadExt as _, AsyncWriteExt as _}; +pub use crate::io::{AsyncBufReadExt as _, AsyncReadExt as _, AsyncWriteExt as _}; diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 74ddacbc309..14ffd20ed21 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -107,6 +107,21 @@ //! `tokio::process::Child` is dropped. The behavior of the standard library can //! be regained with the [`Child::forget`](crate::process::Child::forget) method. +#[path = "unix/mod.rs"] +#[cfg(unix)] +mod imp; + +#[path = "windows.rs"] +#[cfg(windows)] +mod imp; + +mod kill; + +use crate::io::{AsyncRead, AsyncReadExt, AsyncWrite}; +use crate::process::kill::Kill; + +use futures_core::TryFuture; +use futures_util::try_future::try_join3; use std::ffi::OsStr; use std::future::Future; use std::io; @@ -120,21 +135,6 @@ use std::process::{Command as StdCommand, ExitStatus, Output, Stdio}; use std::task::Context; use std::task::Poll; -use self::kill::Kill; -use futures_core::TryFuture; -use futures_util::try_future::try_join3; -use tokio_io::{AsyncRead, AsyncReadExt, AsyncWrite}; - -#[path = "unix/mod.rs"] -#[cfg(unix)] -mod imp; - -#[path = "windows.rs"] -#[cfg(windows)] -mod imp; - -mod kill; - /// This structure mimics the API of [`std::process::Command`] found in the standard library, but /// replaces functions that create a process with an asynchronous variant. The main provided /// asynchronous functions are [spawn](Command::spawn), [status](Command::status), and diff --git a/tokio/src/signal/unix.rs b/tokio/src/signal/unix.rs index e9f63af80ec..dfd8a85faa8 100644 --- a/tokio/src/signal/unix.rs +++ b/tokio/src/signal/unix.rs @@ -5,10 +5,10 @@ #![cfg(unix)] -use super::registry::{globals, EventId, EventInfo, Globals, Init, Storage}; +use crate::io::AsyncRead; use crate::net::util::PollEvented; +use crate::signal::registry::{globals, EventId, EventInfo, Globals, Init, Storage}; -use tokio_io::AsyncRead; use tokio_sync::mpsc::{channel, Receiver}; use futures_core::stream::Stream; diff --git a/tokio/tests/fs_file_mocked.rs b/tokio/tests/fs_file_mocked.rs index b078b3c0b6e..4697814cee6 100644 --- a/tokio/tests/fs_file_mocked.rs +++ b/tokio/tests/fs_file_mocked.rs @@ -30,6 +30,7 @@ pub(crate) mod fs { } use fs::sys; +use tokio::io; use tokio::prelude::*; use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok, task}; diff --git a/tokio-io/tests/async_read.rs b/tokio/tests/io_async_read.rs similarity index 99% rename from tokio-io/tests/async_read.rs rename to tokio/tests/io_async_read.rs index d5baac64e29..b34fcba3942 100644 --- a/tokio-io/tests/async_read.rs +++ b/tokio/tests/io_async_read.rs @@ -1,4 +1,4 @@ -use tokio_io::AsyncRead; +use tokio::io::AsyncRead; use tokio_test::task::MockTask; use tokio_test::{assert_ready_err, assert_ready_ok}; diff --git a/tokio-io/tests/chain.rs b/tokio/tests/io_chain.rs similarity index 91% rename from tokio-io/tests/chain.rs rename to tokio/tests/io_chain.rs index c5ea024e7d1..d7cb47caa50 100644 --- a/tokio-io/tests/chain.rs +++ b/tokio/tests/io_chain.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::AsyncReadExt; +use tokio::io::AsyncReadExt; use tokio_test::assert_ok; #[tokio::test] diff --git a/tokio-io/tests/copy.rs b/tokio/tests/io_copy.rs similarity index 94% rename from tokio-io/tests/copy.rs rename to tokio/tests/io_copy.rs index 2a6a268595f..a9df7430294 100644 --- a/tokio-io/tests/copy.rs +++ b/tokio/tests/io_copy.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::{AsyncRead, AsyncReadExt}; +use tokio::io::{AsyncRead, AsyncReadExt}; use tokio_test::assert_ok; use std::io; diff --git a/tokio-io/tests/lines.rs b/tokio/tests/io_lines.rs similarity index 93% rename from tokio-io/tests/lines.rs rename to tokio/tests/io_lines.rs index 3220b606e02..e85fbff7a7d 100644 --- a/tokio-io/tests/lines.rs +++ b/tokio/tests/io_lines.rs @@ -1,9 +1,10 @@ #![warn(rust_2018_idioms)] -use futures_util::StreamExt; -use tokio_io::AsyncBufReadExt; +use tokio::io::AsyncBufReadExt; use tokio_test::assert_ok; +use futures_util::StreamExt; + #[tokio::test] async fn lines() { let rd: &[u8] = b"hello\r\nworld\n\n"; diff --git a/tokio-io/tests/read.rs b/tokio/tests/io_read.rs similarity index 94% rename from tokio-io/tests/read.rs rename to tokio/tests/io_read.rs index 6ec5316a900..01cd2fd6cc9 100644 --- a/tokio-io/tests/read.rs +++ b/tokio/tests/io_read.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::{AsyncRead, AsyncReadExt}; +use tokio::io::{AsyncRead, AsyncReadExt}; use tokio_test::assert_ok; use std::io; diff --git a/tokio-io/tests/read_exact.rs b/tokio/tests/io_read_exact.rs similarity index 91% rename from tokio-io/tests/read_exact.rs rename to tokio/tests/io_read_exact.rs index 2111c396e43..8b2f20ec41d 100644 --- a/tokio-io/tests/read_exact.rs +++ b/tokio/tests/io_read_exact.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::AsyncReadExt; +use tokio::io::AsyncReadExt; use tokio_test::assert_ok; #[tokio::test] diff --git a/tokio-io/tests/read_line.rs b/tokio/tests/io_read_line.rs similarity index 95% rename from tokio-io/tests/read_line.rs rename to tokio/tests/io_read_line.rs index 22c81227394..684eb14a3fc 100644 --- a/tokio-io/tests/read_line.rs +++ b/tokio/tests/io_read_line.rs @@ -1,9 +1,10 @@ #![warn(rust_2018_idioms)] -use std::io::Cursor; -use tokio_io::AsyncBufReadExt; +use tokio::io::AsyncBufReadExt; use tokio_test::assert_ok; +use std::io::Cursor; + #[tokio::test] async fn read_line() { let mut buf = String::new(); diff --git a/tokio-io/tests/read_to_end.rs b/tokio/tests/io_read_to_end.rs similarity index 90% rename from tokio-io/tests/read_to_end.rs rename to tokio/tests/io_read_to_end.rs index ec8c9e4567c..89782aa32f0 100644 --- a/tokio-io/tests/read_to_end.rs +++ b/tokio/tests/io_read_to_end.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::AsyncReadExt; +use tokio::io::AsyncReadExt; use tokio_test::assert_ok; #[tokio::test] diff --git a/tokio-io/tests/read_to_string.rs b/tokio/tests/io_read_to_string.rs similarity index 91% rename from tokio-io/tests/read_to_string.rs rename to tokio/tests/io_read_to_string.rs index 7c21d95b7d8..270d1e486ed 100644 --- a/tokio-io/tests/read_to_string.rs +++ b/tokio/tests/io_read_to_string.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::AsyncReadExt; +use tokio::io::AsyncReadExt; use tokio_test::assert_ok; #[tokio::test] diff --git a/tokio-io/tests/read_until.rs b/tokio/tests/io_read_until.rs similarity index 94% rename from tokio-io/tests/read_until.rs rename to tokio/tests/io_read_until.rs index 43b3c48b40c..270d0221512 100644 --- a/tokio-io/tests/read_until.rs +++ b/tokio/tests/io_read_until.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::AsyncBufReadExt; +use tokio::io::AsyncBufReadExt; use tokio_test::assert_ok; #[tokio::test] diff --git a/tokio-io/tests/split.rs b/tokio/tests/io_split.rs similarity index 96% rename from tokio-io/tests/split.rs rename to tokio/tests/io_split.rs index 7be96241ca3..c04451a0004 100644 --- a/tokio-io/tests/split.rs +++ b/tokio/tests/io_split.rs @@ -1,5 +1,5 @@ +use tokio::io::split::{ReadHalf, WriteHalf}; use tokio::io::{split, AsyncRead, AsyncWrite}; -use tokio_io::split::{ReadHalf, WriteHalf}; use std::io; use std::pin::Pin; diff --git a/tokio-io/tests/take.rs b/tokio/tests/io_take.rs similarity index 91% rename from tokio-io/tests/take.rs rename to tokio/tests/io_take.rs index 2ad1a04c1c3..7b3363e0174 100644 --- a/tokio-io/tests/take.rs +++ b/tokio/tests/io_take.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::AsyncReadExt; +use tokio::io::AsyncReadExt; use tokio_test::assert_ok; #[tokio::test] diff --git a/tokio-io/tests/write.rs b/tokio/tests/io_write.rs similarity index 95% rename from tokio-io/tests/write.rs rename to tokio/tests/io_write.rs index 08f63ad3ca8..733b38c9e57 100644 --- a/tokio-io/tests/write.rs +++ b/tokio/tests/io_write.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::{AsyncWrite, AsyncWriteExt}; +use tokio::io::{AsyncWrite, AsyncWriteExt}; use tokio_test::assert_ok; use bytes::BytesMut; diff --git a/tokio-io/tests/write_all.rs b/tokio/tests/io_write_all.rs similarity index 96% rename from tokio-io/tests/write_all.rs rename to tokio/tests/io_write_all.rs index 285ed2da9ec..fea46dc3b9a 100644 --- a/tokio-io/tests/write_all.rs +++ b/tokio/tests/io_write_all.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] -use tokio_io::{AsyncWrite, AsyncWriteExt}; +use tokio::io::{AsyncWrite, AsyncWriteExt}; use tokio_test::assert_ok; use bytes::BytesMut;