fix no default feature

This commit is contained in:
fakeshadow 2021-02-21 13:54:03 -08:00
parent 22f251de1a
commit b999ab27a3
3 changed files with 21 additions and 12 deletions

View File

@ -187,7 +187,7 @@ impl<T: AsyncRead + AsyncWrite + Unpin> IoConnection<T> {
} }
#[allow(dead_code)] #[allow(dead_code)]
pub enum EitherIoConnection<A, B> pub(crate) enum EitherIoConnection<A, B>
where where
A: AsyncRead + AsyncWrite + Unpin + 'static, A: AsyncRead + AsyncWrite + Unpin + 'static,
B: AsyncRead + AsyncWrite + Unpin + 'static, B: AsyncRead + AsyncWrite + Unpin + 'static,

View File

@ -15,7 +15,7 @@ use actix_utils::timeout::{TimeoutError, TimeoutService};
use http::Uri; use http::Uri;
use super::config::ConnectorConfig; use super::config::ConnectorConfig;
use super::connection::EitherIoConnection; use super::connection::{Connection, EitherIoConnection};
use super::error::ConnectError; use super::error::ConnectError;
use super::pool::{ConnectionPool, Protocol}; use super::pool::{ConnectionPool, Protocol};
use super::Connect; use super::Connect;
@ -245,12 +245,8 @@ where
/// its combinator chain. /// its combinator chain.
pub fn finish( pub fn finish(
self, self,
) -> InnerConnector< ) -> impl Service<Connect, Response = impl Connection, Error = ConnectError> + Clone
impl Service<Connect, Response = (U, Protocol), Error = ConnectError>, {
impl Service<Connect, Response = (Box<dyn Io>, Protocol), Error = ConnectError>,
U,
Box<dyn Io>,
> {
let tcp_service = TimeoutService::new( let tcp_service = TimeoutService::new(
self.config.timeout, self.config.timeout,
apply_fn(self.connector.clone(), |msg: Connect, srv| { apply_fn(self.connector.clone(), |msg: Connect, srv| {
@ -266,7 +262,20 @@ where
#[cfg(not(any(feature = "openssl", feature = "rustls")))] #[cfg(not(any(feature = "openssl", feature = "rustls")))]
{ {
InnerConnector { // A dummy service for annotate tls pool's type signature.
pub type DummyService = Box<
dyn Service<
Connect,
Response = (Box<dyn Io>, Protocol),
Error = ConnectError,
Future = futures_core::future::LocalBoxFuture<
'static,
Result<(Box<dyn Io>, Protocol), ConnectError>,
>,
>,
>;
InnerConnector::<_, DummyService, _, Box<dyn Io>> {
tcp_pool: ConnectionPool::new( tcp_pool: ConnectionPool::new(
tcp_service, tcp_service,
self.config.no_disconnect_timeout(), self.config.no_disconnect_timeout(),
@ -348,7 +357,7 @@ where
} }
} }
pub struct InnerConnector<S1, S2, Io1, Io2> struct InnerConnector<S1, S2, Io1, Io2>
where where
S1: Service<Connect, Response = (Io1, Protocol), Error = ConnectError> + 'static, S1: Service<Connect, Response = (Io1, Protocol), Error = ConnectError> + 'static,
S2: Service<Connect, Response = (Io2, Protocol), Error = ConnectError> + 'static, S2: Service<Connect, Response = (Io2, Protocol), Error = ConnectError> + 'static,
@ -401,7 +410,7 @@ where
} }
#[pin_project::pin_project(project = InnerConnectorProj)] #[pin_project::pin_project(project = InnerConnectorProj)]
pub enum InnerConnectorResponse<S1, S2, Io1, Io2> enum InnerConnectorResponse<S1, S2, Io1, Io2>
where where
S1: Service<Connect, Response = (Io1, Protocol), Error = ConnectError> + 'static, S1: Service<Connect, Response = (Io1, Protocol), Error = ConnectError> + 'static,
S2: Service<Connect, Response = (Io2, Protocol), Error = ConnectError> + 'static, S2: Service<Connect, Response = (Io2, Protocol), Error = ConnectError> + 'static,

View File

@ -45,7 +45,7 @@ impl From<Authority> for Key {
} }
/// Connections pool for reuse Io type for certain [`http::uri::Authority`] as key. /// Connections pool for reuse Io type for certain [`http::uri::Authority`] as key.
pub struct ConnectionPool<S, Io> pub(crate) struct ConnectionPool<S, Io>
where where
Io: AsyncWrite + Unpin + 'static, Io: AsyncWrite + Unpin + 'static,
{ {