diff options
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | azure-pipelines.yml | 9 | ||||
-rw-r--r-- | ci/patch.toml | 1 | ||||
-rw-r--r-- | tokio-net/Cargo.toml | 26 | ||||
-rw-r--r-- | tokio-net/src/lib.rs | 4 | ||||
-rw-r--r-- | tokio-net/src/tcp/incoming.rs (renamed from tokio-tcp/src/incoming.rs) | 1 | ||||
-rw-r--r-- | tokio-net/src/tcp/listener.rs (renamed from tokio-tcp/src/listener.rs) | 5 | ||||
-rw-r--r-- | tokio-net/src/tcp/mod.rs (renamed from tokio-tcp/src/lib.rs) | 10 | ||||
-rw-r--r-- | tokio-net/src/tcp/split.rs (renamed from tokio-tcp/src/split.rs) | 6 | ||||
-rw-r--r-- | tokio-net/src/tcp/stream.rs (renamed from tokio-tcp/src/stream.rs) | 6 | ||||
-rw-r--r-- | tokio-net/tests/tcp_accept.rs (renamed from tokio-tcp/tests/tcp_accept.rs) | 0 | ||||
-rw-r--r-- | tokio-net/tests/tcp_connect.rs (renamed from tokio-tcp/tests/tcp.rs) | 0 | ||||
-rw-r--r-- | tokio-net/tests/tcp_echo.rs (renamed from tokio-tcp/tests/echo.rs) | 0 | ||||
-rw-r--r-- | tokio-net/tests/tcp_peek.rs (renamed from tokio-tcp/tests/tcp_peek.rs) | 0 | ||||
-rw-r--r-- | tokio-net/tests/tcp_split.rs (renamed from tokio-tcp/tests/split.rs) | 2 | ||||
-rw-r--r-- | tokio-tcp/CHANGELOG.md | 21 | ||||
-rw-r--r-- | tokio-tcp/Cargo.toml | 38 | ||||
-rw-r--r-- | tokio-tcp/LICENSE | 25 | ||||
-rw-r--r-- | tokio-tcp/README.md | 13 | ||||
-rw-r--r-- | tokio-tls/Cargo.toml | 2 | ||||
-rw-r--r-- | tokio-udp/src/lib.rs | 2 | ||||
-rw-r--r-- | tokio/Cargo.toml | 5 | ||||
-rw-r--r-- | tokio/src/net.rs | 2 | ||||
-rw-r--r-- | tokio/tests/reactor.rs | 2 | ||||
-rw-r--r-- | ui-tests/Cargo.toml | 3 | ||||
-rw-r--r-- | ui-tests/src/lib.rs | 3 | ||||
-rw-r--r-- | ui-tests/tests/features.rs | 19 | ||||
-rw-r--r-- | ui-tests/tests/ui/net_without_tcp_missing_tcp.rs | 4 | ||||
-rw-r--r-- | ui-tests/tests/ui/net_without_tcp_missing_tcp.stderr | 7 |
30 files changed, 84 insertions, 139 deletions
@@ -14,7 +14,6 @@ members = [ "tokio-sync", "tokio-test", "tokio-timer", - "tokio-tcp", "tokio-tls", "tokio-udp", "tokio-uds", @@ -140,10 +140,7 @@ The crates included as part of Tokio are: * [`tokio-macros`]: Macros for usage with Tokio. -* [`tokio-net`]: Event loop that drives I/O resources (like TCP and UDP - sockets). - -* [`tokio-tcp`]: TCP listener and acceptor. +* [`tokio-net`]: Event loop that drives I/O resources as well as TCP apis. * [ `tokio-timer`]: Time related APIs. @@ -158,7 +155,6 @@ The crates included as part of Tokio are: [`tokio-io`]: tokio-io [`tokio-macros`]: tokio-macros [`tokio-net`]: tokio-net -[`tokio-tcp`]: tokio-tcp [`tokio-timer`]: tokio-timer [`tokio-udp`]: tokio-udp [`tokio-uds`]: tokio-uds diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e48a8a92..37fe8591 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -47,11 +47,10 @@ jobs: rust: $(nightly) crates: tokio-fs: [] - tokio-net: [] + tokio-net: + - tcp tokio-process: [] tokio-signal: [] - tokio-tcp: - - async-traits tokio-udp: [] tokio-uds: - async-traits @@ -85,7 +84,11 @@ jobs: rust: $(nightly) crates: ui-tests: + - tokio-executor + - tokio-net - executor-without-current-thread + - net-no-features + - net-with-tcp - tokio-no-features - tokio-with-net diff --git a/ci/patch.toml b/ci/patch.toml index 2f2aa87d..3a397618 100644 --- a/ci/patch.toml +++ b/ci/patch.toml @@ -12,7 +12,6 @@ tokio-net = { path = "tokio-net" } tokio-signal = { path = "tokio-signal" } tokio-sync = { path = "tokio-sync" } tokio-timer = { path = "tokio-timer" } -tokio-tcp = { path = "tokio-tcp" } tokio-tls = { path = "tokio-tls" } tokio-udp = { path = "tokio-udp" } tokio-uds = { path = "tokio-uds" } diff --git a/tokio-net/Cargo.toml b/tokio-net/Cargo.toml index ab65ad34..5f5cc50d 100644 --- a/tokio-net/Cargo.toml +++ b/tokio-net/Cargo.toml @@ -20,20 +20,36 @@ Event loop that drives Tokio I/O resources. """ categories = ["asynchronous", "network-programming"] +[features] +async-traits = [] +tcp = [ + "bytes", + "futures-util-preview", + "iovec", +] + [dependencies] +tokio-executor = { version = "=0.2.0-alpha.1", path = "../tokio-executor" } +tokio-io = { version = "=0.2.0-alpha.1", path = "../tokio-io" } +tokio-sync = { version = "=0.2.0-alpha.1", path = "../tokio-sync" } + +# driver implementation crossbeam-utils = "0.6.0" +futures-core-preview = "=0.3.0-alpha.18" lazy_static = "1.0.2" log = "0.4.6" mio = "0.6.14" num_cpus = "1.8.0" parking_lot = "0.9" slab = "0.4.0" -tokio-executor = { version = "=0.2.0-alpha.1", path = "../tokio-executor" } -tokio-io = { version = "=0.2.0-alpha.1", path = "../tokio-io" } -tokio-sync = { version = "=0.2.0-alpha.1", path = "../tokio-sync" } -futures-core-preview = "=0.3.0-alpha.18" + +# TCP +bytes = { version = "0.4", optional = true } +futures-util-preview = { version = "=0.3.0-alpha.18", optional = true } +iovec = { version = "0.1", optional = true } [dev-dependencies] -num_cpus = "1.8.0" tokio = { version = "=0.2.0-alpha.1", path = "../tokio" } +tokio-test = { version = "=0.2.0-alpha.1", path = "../tokio-test" } +num_cpus = "1.8.0" tokio-io-pool = "0.1.4" diff --git a/tokio-net/src/lib.rs b/tokio-net/src/lib.rs index c1393300..ab9bb1a0 100644 --- a/tokio-net/src/lib.rs +++ b/tokio-net/src/lib.rs @@ -6,6 +6,7 @@ unreachable_pub )] #![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))] +#![feature(async_await)] //! Event loop that drives Tokio I/O resources. //! @@ -38,3 +39,6 @@ pub mod driver; pub mod util; + +#[cfg(feature = "tcp")] +pub mod tcp; diff --git a/tokio-tcp/src/incoming.rs b/tokio-net/src/tcp/incoming.rs index 00c2e01d..4679ae0b 100644 --- a/tokio-tcp/src/incoming.rs +++ b/tokio-net/src/tcp/incoming.rs @@ -1,5 +1,6 @@ use super::TcpListener; use super::TcpStream; + use futures_core::ready; use futures_core::stream::Stream; use std::io; diff --git a/tokio-tcp/src/listener.rs b/tokio-net/src/tcp/listener.rs index ac928c12..e90cac9c 100644 --- a/tokio-tcp/src/listener.rs +++ b/tokio-net/src/tcp/listener.rs @@ -1,9 +1,8 @@ #[cfg(feature = "async-traits")] use super::incoming::Incoming; use super::TcpStream; - -use tokio_net::driver::Handle; -use tokio_net::util::PollEvented; +use crate::driver::Handle; +use crate::util::PollEvented; use futures_core::ready; use futures_util::future::poll_fn; diff --git a/tokio-tcp/src/lib.rs b/tokio-net/src/tcp/mod.rs index bcca739f..fa4445af 100644 --- a/tokio-tcp/src/lib.rs +++ b/tokio-net/src/tcp/mod.rs @@ -1,13 +1,3 @@ -#![doc(html_root_url = "https://docs.rs/tokio-tcp/0.2.0-alpha.1")] -#![warn( - missing_debug_implementations, - missing_docs, - rust_2018_idioms, - unreachable_pub -)] -#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))] -#![feature(async_await)] - //! TCP bindings for `tokio`. //! //! This module contains the TCP networking types, similar to the standard diff --git a/tokio-tcp/src/split.rs b/tokio-net/src/tcp/split.rs index a6b98f34..fa6f9221 100644 --- a/tokio-tcp/src/split.rs +++ b/tokio-net/src/tcp/split.rs @@ -13,6 +13,9 @@ //! addresses, to get and set socket options, and to shutdown the sockets. use super::TcpStream; + +use tokio_io::{AsyncRead, AsyncWrite}; + use bytes::{Buf, BufMut}; use std::error::Error; use std::fmt; @@ -21,7 +24,6 @@ use std::net::Shutdown; use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; -use tokio_io::{AsyncRead, AsyncWrite}; /// Read half of a `TcpStream`. #[derive(Debug)] @@ -89,7 +91,7 @@ impl TcpStreamReadHalf { // reader and one for the writer, and those `Arc`s are never exposed // externally. And so when we drop one here, the other one must be // the only remaining one. - Ok(Arc::try_unwrap(self.0).expect("tokio_tcp: try_unwrap failed in reunite")) + Ok(Arc::try_unwrap(self.0).expect("tcp: try_unwrap failed in reunite")) } else { Err(ReuniteError(self, other)) } diff --git a/tokio-tcp/src/stream.rs b/tokio-net/src/tcp/stream.rs index 0a527d43..fb22ab34 100644 --- a/tokio-tcp/src/stream.rs +++ b/tokio-net/src/tcp/stream.rs @@ -1,11 +1,11 @@ -use crate::split::{ +use super::split::{ split, split_mut, TcpStreamReadHalf, TcpStreamReadHalfMut, TcpStreamWriteHalf, TcpStreamWriteHalfMut, }; +use crate::driver::Handle; +use crate::util::PollEvented; use tokio_io::{AsyncRead, AsyncWrite}; -use tokio_net::driver::Handle; -use tokio_net::util::PollEvented; use bytes::{Buf, BufMut}; use futures_core::ready; diff --git a/tokio-tcp/tests/tcp_accept.rs b/tokio-net/tests/tcp_accept.rs index a31096c8..a31096c8 100644 --- a/tokio-tcp/tests/tcp_accept.rs +++ b/tokio-net/tests/tcp_accept.rs diff --git a/tokio-tcp/tests/tcp.rs b/tokio-net/tests/tcp_connect.rs index 3d2316d9..3d2316d9 100644 --- a/tokio-tcp/tests/tcp.rs +++ b/tokio-net/tests/tcp_connect.rs diff --git a/tokio-tcp/tests/echo.rs b/tokio-net/tests/tcp_echo.rs index 0a0c87ca..0a0c87ca 100644 --- a/tokio-tcp/tests/echo.rs +++ b/tokio-net/tests/tcp_echo.rs diff --git a/tokio-tcp/tests/tcp_peek.rs b/tokio-net/tests/tcp_peek.rs index 60f0c76d..60f0c76d 100644 --- a/tokio-tcp/tests/tcp_peek.rs +++ b/tokio-net/tests/tcp_peek.rs diff --git a/tokio-tcp/tests/split.rs b/tokio-net/tests/tcp_split.rs index 8b9701ae..7a21401a 100644 --- a/tokio-tcp/tests/split.rs +++ b/tokio-net/tests/tcp_split.rs @@ -1,6 +1,6 @@ #![feature(async_await)] -use tokio_tcp::{TcpListener, TcpStream}; +use tokio_net::tcp::{TcpListener, TcpStream}; #[tokio::test] async fn split_reunite() -> std::io::Result<()> { diff --git a/tokio-tcp/CHANGELOG.md b/tokio-tcp/CHANGELOG.md deleted file mode 100644 index 7621ca6e..00000000 --- a/tokio-tcp/CHANGELOG.md +++ /dev/null @@ -1,21 +0,0 @@ -# 0.2.0-alpha.1 (August 8, 2019) - -### Changed -- Switch to `async`, `await`, and `std::future`. - -# 0.1.3 (January 6, 2019) - -* Deprecate `TcpStream::try_clone()` (#824). -* Add examples to TcpListener and TcpStream API docs (#775). - -# 0.1.2 (September 27, 2018) - -* Documentation tweaks - -# 0.1.1 (August 6, 2018) - -* Add `TcpStream::try_clone` (#448) - -# 0.1.0 (March 23, 2018) - -* Initial release diff --git a/tokio-tcp/Cargo.toml b/tokio-tcp/Cargo.toml deleted file mode 100644 index aa08f13e..00000000 --- a/tokio-tcp/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "tokio-tcp" -# When releasing to crates.io: -# - Remove path dependencies -# - Update html_root_url. -# - Update doc url -# - Cargo.toml -# - Update CHANGELOG.md. -# - Create "v0.2.x" git tag. -version = "0.2.0-alpha.1" -edition = "2018" -authors = ["Tokio Contributors <team@tokio.rs>"] -license = "MIT" -repository = "https://github.com/tokio-rs/tokio" -homepage = "https://tokio.rs" -documentation = "https://docs.rs/tokio-tcp/0.2.0-alpha.1/tokio_tcp" -description = """ -TCP bindings for tokio. -""" -categories = ["asynchronous"] - -[features] -async-traits = [] - -[dependencies] -tokio-io = { version = "=0.2.0-alpha.1", path = "../tokio-io" } -tokio-net = { version = "=0.2.0-alpha.1", path = "../tokio-net" } - -futures-core-preview = "=0.3.0-alpha.18" -futures-util-preview = "=0.3.0-alpha.18" -bytes = "0.4" -mio = "0.6.14" -iovec = "0.1" - - -[dev-dependencies] -tokio = { version = "=0.2.0-alpha.1", path = "../tokio" } -tokio-test = { version = "=0.2.0-alpha.1", path = "../tokio-test" } diff --git a/tokio-tcp/LICENSE b/tokio-tcp/LICENSE deleted file mode 100644 index cdb28b4b..00000000 --- a/tokio-tcp/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-tcp/README.md b/tokio-tcp/README.md deleted file mode 100644 index dd2c78f2..00000000 --- a/tokio-tcp/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# tokio-tcp - -TCP bindings for `tokio`. - -## 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-tls/Cargo.toml b/tokio-tls/Cargo.toml index 4ce76eec..6c177009 100644 --- a/tokio-tls/Cargo.toml +++ b/tokio-tls/Cargo.toml @@ -30,7 +30,7 @@ tokio-io = { version = "=0.2.0-alpha.1", path = "../tokio-io" } [dev-dependencies] tokio = { version = "=0.2.0-alpha.1", path = "../tokio" } -tokio-tcp = { version = "=0.2.0-alpha.1", path = "../tokio-tcp", features = ["async-traits"] } +tokio-net = { version = "=0.2.0-alpha.1", path = "../tokio-net", features = ["tcp", "async-traits"] } cfg-if = "0.1" env_logger = { version = "0.6", default-features = false } diff --git a/tokio-udp/src/lib.rs b/tokio-udp/src/lib.rs index 04ac9d4d..20de7ade 100644 --- a/tokio-udp/src/lib.rs +++ b/tokio-udp/src/lib.rs @@ -1,4 +1,4 @@ -#![doc(html_root_url = "https://docs.rs/tokio-tcp/0.2.0-alpha.1")] +#![doc(html_root_url = "https://docs.rs/tokio-udp/0.2.0-alpha.1")] #![warn( missing_debug_implementations, missing_docs, diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index 815346b6..2b37a32c 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -49,7 +49,7 @@ rt-full = [ "tracing-core", ] sync = ["tokio-sync"] -tcp = ["io", "tokio-net", "tokio-tcp"] +tcp = ["io", "tokio-net/tcp"] timer = ["tokio-timer"] udp = ["io", "tokio-net", "tokio-udp"] uds = ["io", "tokio-net", "tokio-uds"] @@ -67,9 +67,8 @@ tokio-fs = { version = "=0.2.0-alpha.1", optional = true, path = "../tokio-fs" } tokio-io = { version = "=0.2.0-alpha.1", optional = true, features = ["util"], path = "../tokio-io" } tokio-executor = { version = "=0.2.0-alpha.1", optional = true, path = "../tokio-executor" } tokio-macros = { version = "=0.2.0-alpha.1", optional = true, path = "../tokio-macros" } -tokio-net = { version = "=0.2.0-alpha.1", optional = true, path = "../tokio-net" } +tokio-net = { version = "=0.2.0-alpha.1", optional = true, features = ["async-traits"], path = "../tokio-net" } tokio-sync = { version = "=0.2.0-alpha.1", optional = true, path = "../tokio-sync", features = ["async-traits"] } -tokio-tcp = { version = "=0.2.0-alpha.1", optional = true, path = "../tokio-tcp", features = ["async-traits"] } tokio-udp = { version = "=0.2.0-alpha.1", optional = true, path = "../tokio-udp" } tokio-timer = { version = "=0.3.0-alpha.1", optional = true, path = "../tokio-timer", features = ["async-traits"] } tracing-core = { version = "0.1", optional = true } diff --git a/tokio/src/net.rs b/tokio/src/net.rs index 84675fdf..6163d880 100644 --- a/tokio/src/net.rs +++ b/tokio/src/net.rs @@ -40,7 +40,7 @@ pub mod tcp { //! [`TcpListener`]: struct.TcpListener.html //! [incoming_method]: struct.TcpListener.html#method.incoming //! [`Incoming`]: struct.Incoming.html - pub use tokio_tcp::{split, TcpListener, TcpStream}; + pub use tokio_net::tcp::{split, TcpListener, TcpStream}; } #[cfg(feature = "tcp")] pub use self::tcp::{TcpListener, TcpStream}; diff --git a/tokio/tests/reactor.rs b/tokio/tests/reactor.rs index 8e93bd48..d39a5a3d 100644 --- a/tokio/tests/reactor.rs +++ b/tokio/tests/reactor.rs @@ -3,7 +3,7 @@ #![cfg(feature = "default")] use tokio_net::driver::Reactor; -use tokio_tcp::TcpListener; +use tokio_net::tcp::TcpListener; use tokio_test::{assert_ok, assert_pending}; use futures_util::task::{waker_ref, ArcWake}; diff --git a/ui-tests/Cargo.toml b/ui-tests/Cargo.toml index ed401cb9..1e472785 100644 --- a/ui-tests/Cargo.toml +++ b/ui-tests/Cargo.toml @@ -7,6 +7,8 @@ publish = false [features] executor-without-current-thread = ["tokio-executor"] +net-no-features = ["tokio-net"] +net-with-tcp = ["tokio-net/tcp"] tokio-no-features = ["tokio"] tokio-with-net = ["tokio/net"] @@ -14,6 +16,7 @@ tokio-with-net = ["tokio/net"] [dependencies] tokio-executor = { path = "../tokio-executor", optional = true } +tokio-net = { path = "../tokio-net", optional = true } tokio = { path = "../tokio", optional = true, default-features = false } [dev-dependencies] diff --git a/ui-tests/src/lib.rs b/ui-tests/src/lib.rs index 632e91d5..7f38a440 100644 --- a/ui-tests/src/lib.rs +++ b/ui-tests/src/lib.rs @@ -1,5 +1,8 @@ #[cfg(feature = "tokio-executor")] pub use tokio_executor; +#[cfg(feature = "tokio-net")] +pub use tokio_net; + #[cfg(feature = "tokio")] pub use tokio; diff --git a/ui-tests/tests/features.rs b/ui-tests/tests/features.rs index be69854c..c760b869 100644 --- a/ui-tests/tests/features.rs +++ b/ui-tests/tests/features.rs @@ -1,6 +1,20 @@ +#![allow(unused_imports)] + +#[test] +#[cfg(feature = "tokio-net")] +fn net_default() { + use ui_tests::tokio_net::driver::{set_default, Handle, Reactor, Registration}; + use ui_tests::tokio_net::util::PollEvented; +} + +#[test] +#[cfg(feature = "net-with-tcp")] +fn net_with_tcp() { + use ui_tests::tokio_net::tcp; +} + #[test] #[cfg(feature = "tokio-with-net")] -#[allow(unused_imports)] fn tokio_with_net() { // net is present use ui_tests::tokio::net; @@ -12,6 +26,9 @@ fn compile_fail() { #[cfg(feature = "executor-without-current-thread")] t.compile_fail("tests/ui/executor_without_current_thread.rs"); + #[cfg(feature = "net-no-features")] + t.compile_fail("tests/ui/net_without_tcp_missing_tcp.rs"); + #[cfg(feature = "tokio-no-features")] t.compile_fail("tests/ui/tokio_without_net_missing_net.rs"); diff --git a/ui-tests/tests/ui/net_without_tcp_missing_tcp.rs b/ui-tests/tests/ui/net_without_tcp_missing_tcp.rs new file mode 100644 index 00000000..6cb0027b --- /dev/null +++ b/ui-tests/tests/ui/net_without_tcp_missing_tcp.rs @@ -0,0 +1,4 @@ +use ui_tests::tokio_net::tcp; + +fn main() {} + diff --git a/ui-tests/tests/ui/net_without_tcp_missing_tcp.stderr b/ui-tests/tests/ui/net_without_tcp_missing_tcp.stderr new file mode 100644 index 00000000..91fb4d89 --- /dev/null +++ b/ui-tests/tests/ui/net_without_tcp_missing_tcp.stderr @@ -0,0 +1,7 @@ +error[E0432]: unresolved import `ui_tests::tokio_net::tcp` + --> $DIR/net_without_tcp_missing_tcp.rs:1:5 + | +1 | use ui_tests::tokio_net::tcp; + | ^^^^^^^^^^^^^^^^^^^^^^^^ no `tcp` in `tokio_net` + +For more information about this error, try `rustc --explain E0432`. |