Reduce futures optional features (#737)

This commit is contained in:
Sean McArthur
2019-12-12 12:34:44 -08:00
committed by GitHub
parent be52c4d558
commit a57afd50ea
2 changed files with 6 additions and 35 deletions

View File

@@ -51,8 +51,8 @@ bytes = "0.5"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
base64 = "0.11" base64 = "0.11"
encoding_rs = "0.8" encoding_rs = "0.8"
futures-core = { version = "0.3.0" } futures-core = { version = "0.3.0", default-features = false }
futures-util = { version = "0.3.0" } futures-util = { version = "0.3.0", default-features = false }
http-body = "0.3.0" http-body = "0.3.0"
hyper = { version = "0.13", default-features = false, features = ["tcp"] } hyper = { version = "0.13", default-features = false, features = ["tcp"] }
lazy_static = "1.4" lazy_static = "1.4"

View File

@@ -1,4 +1,3 @@
use futures_util::FutureExt;
use hyper::service::Service; use hyper::service::Service;
use http::uri::{Scheme, Authority}; use http::uri::{Scheme, Authority};
use http::Uri; use http::Uri;
@@ -413,48 +412,20 @@ impl Service<Uri> for Connector
let timeout = self.timeout; let timeout = self.timeout;
for prox in self.proxies.iter() { for prox in self.proxies.iter() {
if let Some(proxy_scheme) = prox.intercept(&dst) { if let Some(proxy_scheme) = prox.intercept(&dst) {
return with_timeout( return Box::pin(with_timeout(
self.clone().connect_via_proxy(dst, proxy_scheme), self.clone().connect_via_proxy(dst, proxy_scheme),
timeout, timeout,
) ));
.boxed();
} }
} }
with_timeout( Box::pin(with_timeout(
self.clone().connect_with_maybe_proxy(dst, false), self.clone().connect_with_maybe_proxy(dst, false),
timeout, timeout,
) ))
.boxed()
} }
} }
//impl Connect for Connector {
// type Transport = Conn;
// type Error = BoxError;
// type Future = Connecting;
//
// fn connect(&self, dst: Uri) -> Self::Future {
// let timeout = self.timeout;
// for prox in self.proxies.iter() {
// if let Some(proxy_scheme) = prox.intercept(&dst) {
// return with_timeout(
// self.clone().connect_via_proxy(dst, proxy_scheme),
// timeout,
// )
// .boxed();
// }
// }
//
// with_timeout(
// self.clone().connect_with_maybe_proxy(dst, false),
// timeout,
// )
// .boxed()
// }
//}
pub(crate) trait AsyncConn: AsyncRead + AsyncWrite + Connection {} pub(crate) trait AsyncConn: AsyncRead + AsyncWrite + Connection {}
impl<T: AsyncRead + AsyncWrite + Connection> AsyncConn for T {} impl<T: AsyncRead + AsyncWrite + Connection> AsyncConn for T {}