Skip to content

Commit a85ff3d

Browse files
authored
Merge pull request #20 from tesaguri/cleanup-deps
Cleanup dependencies
2 parents 22e2e95 + 69f5d45 commit a85ff3d

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ repository = "https://github.com/hjr3/hyper-timeout"
1111
readme = "README.md"
1212

1313
[dependencies]
14-
bytes = "1.0.0"
15-
hyper = { version = "0.14", default-features = false, features = ["client", "http1", "tcp"] }
14+
hyper = { version = "0.14.2", features = ["client"] }
1615
pin-project-lite = "0.2"
1716
tokio = "1.0.0"
1817
tokio-io-timeout = "1.0.1"
1918

2019
[dev-dependencies]
20+
hyper = { version = "0.14", features = ["client", "http1", "tcp"] }
2121
#FIXME enable when https://github.com/hyperium/hyper-tls/pull/79 lands
2222
#hyper-tls = "0.4"
2323
tokio = { version = "1.0.0", features = ["io-std", "io-util", "macros"] }

src/lib.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use tokio::io::{AsyncRead, AsyncWrite};
88
use tokio::time::timeout;
99
use tokio_io_timeout::TimeoutStream;
1010

11-
use hyper::client::connect::{Connect, Connected, Connection};
11+
use hyper::client::connect::{Connected, Connection};
1212
use hyper::{service::Service, Uri};
1313

1414
mod stream;
@@ -30,7 +30,13 @@ pub struct TimeoutConnector<T> {
3030
write_timeout: Option<Duration>,
3131
}
3232

33-
impl<T: Connect> TimeoutConnector<T> {
33+
impl<T> TimeoutConnector<T>
34+
where
35+
T: Service<Uri> + Send,
36+
T::Response: AsyncRead + AsyncWrite + Send + Unpin,
37+
T::Future: Send + 'static,
38+
T::Error: Into<BoxError>,
39+
{
3440
/// Construct a new TimeoutConnector with a given connector implementing the `Connect` trait
3541
pub fn new(connector: T) -> Self {
3642
TimeoutConnector {
@@ -116,9 +122,12 @@ impl<T> TimeoutConnector<T> {
116122
}
117123
}
118124

119-
impl<T: Connect> Connection for TimeoutConnector<T>
125+
impl<T> Connection for TimeoutConnector<T>
120126
where
121-
T: AsyncRead + AsyncWrite + Connection + Unpin,
127+
T: AsyncRead + AsyncWrite + Connection + Service<Uri> + Send + Unpin,
128+
T::Response: AsyncRead + AsyncWrite + Send + Unpin,
129+
T::Future: Send + 'static,
130+
T::Error: Into<BoxError>,
122131
{
123132
fn connected(&self) -> Connected {
124133
self.connector.connected()

0 commit comments

Comments
 (0)