summaryrefslogtreecommitdiffstats
path: root/tokio-net/tests/support.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2019-10-25 12:50:15 -0700
committerGitHub <noreply@github.com>2019-10-25 12:50:15 -0700
commit227533d456fe32e48ffcd3796f1e6c8f9318b230 (patch)
tree498029aaf42dd64eeb8ef0e7d7f29802b45d4e95 /tokio-net/tests/support.rs
parent03a9378297c73c2e56a6d6b55db22b92427b850a (diff)
net: move into tokio crate (#1683)
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.
Diffstat (limited to 'tokio-net/tests/support.rs')
-rw-r--r--tokio-net/tests/support.rs34
1 files changed, 0 insertions, 34 deletions
diff --git a/tokio-net/tests/support.rs b/tokio-net/tests/support.rs
deleted file mode 100644
index 45c4c925..00000000
--- a/tokio-net/tests/support.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-#![warn(rust_2018_idioms)]
-#![allow(dead_code)]
-
-pub use tokio::runtime::current_thread::{self, Runtime as CurrentThreadRuntime};
-use tokio::timer::Timeout;
-
-#[cfg(all(unix, feature = "signal"))]
-pub use tokio_net::signal::unix::{signal, SignalKind};
-
-pub use futures_util::future;
-use futures_util::future::FutureExt;
-pub use futures_util::stream::StreamExt;
-#[cfg(unix)]
-use libc::{c_int, getpid, kill};
-use std::future::Future;
-use std::time::Duration;
-
-pub fn with_timeout<F: Future>(future: F) -> impl Future<Output = F::Output> {
- Timeout::new(future, Duration::from_secs(3)).map(Result::unwrap)
-}
-
-pub fn run_with_timeout<F>(rt: &mut CurrentThreadRuntime, future: F) -> F::Output
-where
- F: Future,
-{
- rt.block_on(with_timeout(future))
-}
-
-#[cfg(unix)]
-pub fn send_signal(signal: c_int) {
- unsafe {
- assert_eq!(kill(getpid(), signal), 0);
- }
-}