feat(client): expose connect types without proto feature (#2377)
				
					
				
			Make it possible to refer to Connected, Connection, HttpConnector, etc. without enabling either of the http1/http2 features. This makes feature selection work better for downstream libraries like hyper-openssl, which don't want to commit to any particular protocol. Fix #2376.
This commit is contained in:
		| @@ -27,6 +27,7 @@ use super::{Connected, Connection}; | ||||
| /// | ||||
| /// Sets the [`HttpInfo`](HttpInfo) value on responses, which includes | ||||
| /// transport information such as the remote socket address used. | ||||
| #[cfg_attr(docsrs, doc(cfg(feature = "tcp")))] | ||||
| #[derive(Clone)] | ||||
| pub struct HttpConnector<R = GaiResolver> { | ||||
|     config: Arc<Config>, | ||||
|   | ||||
| @@ -83,13 +83,20 @@ use std::fmt; | ||||
|  | ||||
| use ::http::Extensions; | ||||
|  | ||||
| #[cfg(feature = "tcp")] | ||||
| pub mod dns; | ||||
| #[cfg(feature = "tcp")] | ||||
| mod http; | ||||
| #[cfg(feature = "tcp")] | ||||
| pub use self::http::{HttpConnector, HttpInfo}; | ||||
| pub use self::sealed::Connect; | ||||
| cfg_feature! { | ||||
|     #![feature = "tcp"] | ||||
|  | ||||
|     pub use self::http::{HttpConnector, HttpInfo}; | ||||
|  | ||||
|     pub mod dns; | ||||
|     mod http; | ||||
| } | ||||
|  | ||||
| cfg_feature! { | ||||
|     #![any(feature = "http1", feature = "http2")] | ||||
|  | ||||
|     pub use self::sealed::Connect; | ||||
| } | ||||
|  | ||||
| /// Describes a type returned by a connector. | ||||
| pub trait Connection { | ||||
| @@ -260,6 +267,7 @@ where | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(any(feature = "http1", feature = "http2"))] | ||||
| pub(super) mod sealed { | ||||
|     use std::error::Error as StdError; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user