diff --git a/Cargo.toml b/Cargo.toml index f1a8cd7b..f20ca01c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ hyper = { version = "1.4.0", features = ["full"] } bytes = "1" futures-util = { version = "0.3.16", default-features = false, features = ["alloc"] } http-body-util = "0.1.0" -tokio = { version = "1", features = ["macros", "test-util", "signal"] } +tokio = { version = "1", features = ["macros", "test-util", "signal", "net"] } tokio-test = "0.4" tower-test = "0.4" pretty_env_logger = "0.5" diff --git a/src/server/conn/auto/mod.rs b/src/server/conn/auto/mod.rs index 5e334163..01ec8e10 100644 --- a/src/server/conn/auto/mod.rs +++ b/src/server/conn/auto/mod.rs @@ -80,12 +80,15 @@ impl Builder { /// # Example /// /// ``` + /// # #[cfg(feature = "tokio")] + /// # { /// use hyper_util::{ /// rt::TokioExecutor, /// server::conn::auto, /// }; /// /// auto::Builder::new(TokioExecutor::new()); + /// # } /// ``` pub fn new(executor: E) -> Self { Self { @@ -171,6 +174,8 @@ impl Builder { /// # Example /// /// ``` + /// # #[cfg(feature = "tokio")] + /// # { /// use hyper_util::{ /// rt::TokioExecutor, /// server::conn::auto, @@ -178,6 +183,7 @@ impl Builder { /// /// auto::Builder::new(TokioExecutor::new()) /// .title_case_headers(true); + /// # } /// ``` #[cfg(feature = "http1")] pub fn title_case_headers(mut self, enabled: bool) -> Self { @@ -195,6 +201,8 @@ impl Builder { /// # Example /// /// ``` + /// # #[cfg(feature = "tokio")] + /// # { /// use hyper_util::{ /// rt::TokioExecutor, /// server::conn::auto, @@ -202,6 +210,7 @@ impl Builder { /// /// auto::Builder::new(TokioExecutor::new()) /// .preserve_header_case(true); + /// # } /// ``` #[cfg(feature = "http1")] pub fn preserve_header_case(mut self, enabled: bool) -> Self { @@ -1124,7 +1133,7 @@ impl Http2Builder<'_, E> { } } -#[cfg(test)] +#[cfg(all(feature = "tokio", test))] mod tests { use crate::{ rt::{TokioExecutor, TokioIo},