feat(client): change connectors to return an impl Connection

Instead of returning a tuple `(impl AsyncRead + AsyncWrite, Connected)`,
this adds a new trait, `hyper::client::connect::Connection`, which
allows querying the connection type for a `Connected`.

BREAKING CHANGE: Connectors no longer return a tuple of
  `(T, Connected)`, but a single `T: Connection`.
This commit is contained in:
Sean McArthur
2019-12-04 15:17:49 -08:00
parent 319e8aee15
commit 4d7a2266b8
6 changed files with 68 additions and 37 deletions

View File

@@ -3,8 +3,7 @@
use std::env;
use std::io::{self, Write};
use hyper::Client;
use futures_util::StreamExt;
use hyper::{Client, body::HttpBody as _};
// A simple type alias so as to DRY.
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;