feat(lib): add optional tcp feature, split from runtime

The `HttpConnector` and `AddrListener` types which make use of
`tokio::tcp` have been made their own optional feature. This allows
using them without requiring the *full* tokio runtime.
This commit is contained in:
Sean McArthur
2019-10-01 09:28:13 -07:00
parent 02b584435f
commit 5b348b821c
10 changed files with 57 additions and 43 deletions

View File

@@ -35,7 +35,7 @@ pub(crate) enum Kind {
/// Error occurred while connecting.
Connect,
/// Error creating a TcpListener.
#[cfg(feature = "runtime")]
#[cfg(feature = "tcp")]
Listen,
/// Error accepting on an Incoming stream.
Accept,
@@ -200,7 +200,7 @@ impl Error {
Error::new(Kind::Io).with(cause)
}
#[cfg(feature = "runtime")]
#[cfg(feature = "tcp")]
pub(crate) fn new_listen<E: Into<Cause>>(cause: E) -> Error {
Error::new(Kind::Listen).with(cause)
}
@@ -326,7 +326,7 @@ impl StdError for Error {
Kind::ChannelClosed => "channel closed",
Kind::Connect => "error trying to connect",
Kind::Canceled => "operation was canceled",
#[cfg(feature = "runtime")]
#[cfg(feature = "tcp")]
Kind::Listen => "error creating server listener",
Kind::Accept => "error accepting connection",
Kind::Body => "error reading a body from connection",