Skip to content

Commit

Permalink
net: move into tokio crate
Browse files Browse the repository at this point in the history
A step towards collapsing Tokio sub crates into a single `tokio`
crate (#1318).

The `net` implementation is now provided by the main `tokio` crate.
Functionality can be opted out of by using the various net related
feature flags.
  • Loading branch information
carllerche committed Oct 24, 2019
1 parent 99940ae commit 7351dcc
Show file tree
Hide file tree
Showing 101 changed files with 454 additions and 828 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ members = [
"tokio-executor",
"tokio-io",
"tokio-macros",
"tokio-net",
"tokio-sync",
"tokio-test",
"tokio-tls",
"tokio-util",

# Internal
"examples",
"build-tests",
"tests-build",
"tests-integration",
]
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- timer
- udp
- uds
tests-integration: []

# Test crates that are platform specific
- template: ci/azure-test-stable.yml
Expand Down Expand Up @@ -79,7 +80,7 @@ jobs:
displayName: Test feature flags
rust: beta
crates:
build-tests:
tests-build:
- tokio-executor
- tokio-net
- executor-without-current-thread
Expand Down
27 changes: 0 additions & 27 deletions build-tests/Cargo.toml

This file was deleted.

26 changes: 26 additions & 0 deletions tests-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "tests-build"
version = "0.1.0"
authors = ["Tokio Contributors <team@tokio.rs>"]
edition = "2018"
publish = false

[features]
executor-without-current-thread = ["tokio-executor"]
# macros-invalid-input = ["tokio/rt-full"]
# net-no-features = ["tokio-net"]
# net-with-tcp = ["tokio-net/tcp"]
# net-with-udp = ["tokio-net/udp"]
# net-with-uds = ["tokio-net/uds"]
# net-with-process = ["tokio-net/process"]
# tokio-no-features = ["tokio"]
# tokio-with-net = ["tokio/net-full"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio-executor = { path = "../tokio-executor", optional = true }
# tokio = { path = "../tokio", optional = true, default-features = false }

[dev-dependencies]
trybuild = "1.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions tests-integration/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "tests-integration"
version = "0.1.0"
authors = ["Tokio Contributors <team@tokio.rs>"]
edition = "2018"
publish = false

[dependencies]

[dev-dependencies]
tokio = { path = "../tokio" }
tokio-test = { path = "../tokio-test" }

futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
1 change: 1 addition & 0 deletions tests-integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tests that require additional components than just the `tokio` crate.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
#![cfg(feature = "process")]
#![warn(rust_2018_idioms)]

use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio_net::process::{Child, Command};
use tokio::process::{Child, Command};
use tokio_test::assert_ok;

use futures_util::future;
use futures_util::future::FutureExt;
use futures_util::stream::StreamExt;
use futures::future::{self, FutureExt};
use futures::stream::StreamExt;
use std::env;
use std::io;
use std::process::{ExitStatus, Stdio};

mod support;
use support::*;

fn cat() -> Command {
let mut me = env::current_exe().unwrap();
me.pop();
Expand Down Expand Up @@ -95,7 +91,7 @@ async fn feed_cat(mut cat: Child, n: usize) -> io::Result<ExitStatus> {
#[tokio::test]
async fn feed_a_lot() {
let child = cat().spawn().unwrap();
let status = with_timeout(feed_cat(child, 10000)).await.unwrap();
let status = feed_cat(child, 10000).await.unwrap();
assert_eq!(status.code(), Some(0));
}

Expand All @@ -113,7 +109,7 @@ async fn wait_with_output_captures() {
out.await
};

let output = with_timeout(future).await.unwrap();
let output = future.await.unwrap();

assert!(output.status.success());
assert_eq!(output.stdout, write_bytes);
Expand All @@ -127,7 +123,5 @@ async fn status_closes_any_pipes() {
// we would end up blocking forever (and time out).
let child = cat().status();

with_timeout(child)
.await
.expect("time out exceeded! did we get stuck waiting on the child?");
assert_ok!(child.await);
}
2 changes: 1 addition & 1 deletion tokio-executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ categories = ["concurrency", "asynchronous"]
[features]
blocking = ["tokio-sync", "lazy_static"]
current-thread = ["crossbeam-channel"]
thread-pool = ["num_cpus"]
thread-pool = ["num_cpus", "tokio-sync"]

[dependencies]
futures-util-preview = { version = "=0.3.0-alpha.19", features = ["channel"] }
Expand Down
98 changes: 0 additions & 98 deletions tokio-net/CHANGELOG.md

This file was deleted.

109 changes: 0 additions & 109 deletions tokio-net/Cargo.toml

This file was deleted.

25 changes: 0 additions & 25 deletions tokio-net/LICENSE

This file was deleted.

Loading

0 comments on commit 7351dcc

Please sign in to comment.