diff --git a/Cargo.toml b/Cargo.toml index 1245b17..841c4b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,8 @@ pin-project-lite = "0.2.4" socket2 = { version = "0.5", optional = true, features = ["all"] } tracing = { version = "0.1", default-features = false, features = ["std"] } tokio = { version = "1", optional = true, features = ["net", "rt", "time"] } -tower-service = "0.3" -tower = { version = "0.4.1", features = ["make", "util"] } +tower-service ={ version = "0.3", optional = true } +tower = { version = "0.4.1", optional = true, features = ["make", "util"] } [dev-dependencies] hyper = { version = "1.0.0", features = ["full"] } @@ -49,17 +49,20 @@ full = [ "client-legacy", "server", "server-auto", + "service", "http1", "http2", "tokio", ] -client = ["hyper/client"] +client = ["hyper/client", "dep:tower", "dep:tower-service"] client-legacy = ["client"] server = ["hyper/server"] server-auto = ["server", "http1", "http2"] +service = ["dep:tower", "dep:tower-service"] + http1 = ["hyper/http1"] http2 = ["hyper/http2"] diff --git a/src/lib.rs b/src/lib.rs index 04979c7..15a5811 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,6 +13,7 @@ pub mod rt; #[cfg(feature = "server")] pub mod server; #[cfg(all( + feature = "service", any(feature = "http1", feature = "http2"), any(feature = "server", feature = "client") ))] diff --git a/src/service.rs b/src/service.rs index 4664bd1..4652a6a 100644 --- a/src/service.rs +++ b/src/service.rs @@ -9,10 +9,6 @@ use std::{ use tower::{util::Oneshot, ServiceExt}; /// A tower service converted into a hyper service. -#[cfg(all( - any(feature = "http1", feature = "http2"), - any(feature = "server", feature = "client") -))] #[derive(Debug, Copy, Clone)] pub struct TowerToHyperService { service: S, @@ -44,10 +40,6 @@ where pin_project! { /// Response future for [`TowerToHyperService`]. - #[cfg(all( - any(feature = "http1", feature = "http2"), - any(feature = "server", feature = "client") - ))] pub struct TowerToHyperServiceFuture where S: tower_service::Service,