Skip to content

Commit

Permalink
feat: tower should be an optional dependency (#79)
Browse files Browse the repository at this point in the history
* feat: tower should be an optional dependency

* fix cfg of the service feature

* fix cfg of mod service
  • Loading branch information
sigoden authored Dec 16, 2023
1 parent 99409f5 commit 61724d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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"]

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
))]
Expand Down
8 changes: 0 additions & 8 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<S> {
service: S,
Expand Down Expand Up @@ -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<S, R>
where
S: tower_service::Service<R>,
Expand Down

0 comments on commit 61724d1

Please sign in to comment.