feat(service): rename Service to HttpService, re-export tower::Service`

The only important trait for a user is the `tower::Service` trait, which
is now available also at `hyper::service::Service`. The other "trait
aliases" are no longer publicly exported, as people thought they had to
implement them.

Also removes dependency on `tower-make`, which is trivial but otherwise
shouldn't affect anyone.

Closes #1959
This commit is contained in:
Sean McArthur
2019-10-18 16:55:15 -07:00
parent ca5836f1ec
commit 4f2743991c
15 changed files with 260 additions and 271 deletions

View File

@@ -1,7 +1,9 @@
#![deny(warnings)]
use hyper::client::service::{Connect, Service, MakeService};
use hyper::client::service::Connect;
use hyper::client::conn::Builder;
use hyper::client::connect::HttpConnector;
use hyper::service::Service;
use hyper::{Body, Request};
#[tokio::main]
@@ -13,7 +15,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let uri = "http://127.0.0.1:8080".parse::<http::Uri>()?;
let mut svc = mk_svc.make_service(uri.clone()).await?;
let mut svc = mk_svc.call(uri.clone()).await?;
let body = Body::empty();

View File

@@ -1,10 +1,11 @@
#![deny(warnings)]
use hyper::{Body, Request, Response, Server};
use tower_service::Service;
use futures_util::future;
use std::task::{Context, Poll};
use futures_util::future;
use hyper::{Body, Request, Response, Server};
use hyper::service::Service;
const ROOT: &'static str = "/";
#[derive(Debug)]