feat(rt): make tokio runtime optional
A Cargo feature `runtime` is added, which is enabled by default, that includes the following: - The `client::HttpConnector`, which uses `tokio::net::TcpStream`. - The `server::AddrStream`, which uses `tokio::net::TcpListener`. - The `hyper::rt` module, which includes useful utilities to work with the runtime without needing to import `futures` or `tokio` explicity. Disabling the feature removes many of these niceties, but allows people to use hyper in environments that have an alternative runtime, without needing to download an unused one.
This commit is contained in:
		| @@ -39,6 +39,7 @@ pub(crate) enum Kind { | ||||
|     /// Error occurred while connecting. | ||||
|     Connect, | ||||
|     /// Error creating a TcpListener. | ||||
|     #[cfg(feature = "runtime")] | ||||
|     Listen, | ||||
|     /// Error accepting on an Incoming stream. | ||||
|     Accept, | ||||
| @@ -171,6 +172,7 @@ impl Error { | ||||
|         Error::new(Kind::Io, Some(cause.into())) | ||||
|     } | ||||
|  | ||||
|     #[cfg(feature = "runtime")] | ||||
|     pub(crate) fn new_listen<E: Into<Cause>>(cause: E) -> Error { | ||||
|         Error::new(Kind::Listen, Some(cause.into())) | ||||
|     } | ||||
| @@ -258,6 +260,7 @@ impl StdError for Error { | ||||
|             Kind::Closed => "connection closed", | ||||
|             Kind::Connect => "an error occurred trying to connect", | ||||
|             Kind::Canceled => "an operation was canceled internally before starting", | ||||
|             #[cfg(feature = "runtime")] | ||||
|             Kind::Listen => "error creating server listener", | ||||
|             Kind::Accept => "error accepting connection", | ||||
|             Kind::NewService => "calling user's new_service failed", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user