Skip to content

Commit 61724d1

Browse files
authored
feat: tower should be an optional dependency (#79)
* feat: tower should be an optional dependency * fix cfg of the service feature * fix cfg of mod service
1 parent 99409f5 commit 61724d1

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pin-project-lite = "0.2.4"
2727
socket2 = { version = "0.5", optional = true, features = ["all"] }
2828
tracing = { version = "0.1", default-features = false, features = ["std"] }
2929
tokio = { version = "1", optional = true, features = ["net", "rt", "time"] }
30-
tower-service = "0.3"
31-
tower = { version = "0.4.1", features = ["make", "util"] }
30+
tower-service ={ version = "0.3", optional = true }
31+
tower = { version = "0.4.1", optional = true, features = ["make", "util"] }
3232

3333
[dev-dependencies]
3434
hyper = { version = "1.0.0", features = ["full"] }
@@ -49,17 +49,20 @@ full = [
4949
"client-legacy",
5050
"server",
5151
"server-auto",
52+
"service",
5253
"http1",
5354
"http2",
5455
"tokio",
5556
]
5657

57-
client = ["hyper/client"]
58+
client = ["hyper/client", "dep:tower", "dep:tower-service"]
5859
client-legacy = ["client"]
5960

6061
server = ["hyper/server"]
6162
server-auto = ["server", "http1", "http2"]
6263

64+
service = ["dep:tower", "dep:tower-service"]
65+
6366
http1 = ["hyper/http1"]
6467
http2 = ["hyper/http2"]
6568

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub mod rt;
1313
#[cfg(feature = "server")]
1414
pub mod server;
1515
#[cfg(all(
16+
feature = "service",
1617
any(feature = "http1", feature = "http2"),
1718
any(feature = "server", feature = "client")
1819
))]

src/service.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ use std::{
99
use tower::{util::Oneshot, ServiceExt};
1010

1111
/// A tower service converted into a hyper service.
12-
#[cfg(all(
13-
any(feature = "http1", feature = "http2"),
14-
any(feature = "server", feature = "client")
15-
))]
1612
#[derive(Debug, Copy, Clone)]
1713
pub struct TowerToHyperService<S> {
1814
service: S,
@@ -44,10 +40,6 @@ where
4440

4541
pin_project! {
4642
/// Response future for [`TowerToHyperService`].
47-
#[cfg(all(
48-
any(feature = "http1", feature = "http2"),
49-
any(feature = "server", feature = "client")
50-
))]
5143
pub struct TowerToHyperServiceFuture<S, R>
5244
where
5345
S: tower_service::Service<R>,

0 commit comments

Comments
 (0)