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

@@ -65,7 +65,7 @@ use pin_project::pin_project;
use crate::body::{Body, Payload};
use crate::common::exec::{Exec, H2Exec, NewSvcExec};
use crate::common::{Future, Pin, Poll, Unpin, task};
use crate::service::{MakeServiceRef, Service};
use crate::service::{MakeServiceRef, HttpService};
use self::accept::Accept;
// Renamed `Http` as `Http_` for now so that people upgrading don't see an
// error that `hyper::server::Http` is private...
@@ -152,7 +152,7 @@ where
S::Service: 'static,
B: Payload,
B::Data: Unpin,
E: H2Exec<<S::Service as Service<Body>>::Future, B>,
E: H2Exec<<S::Service as HttpService<Body>>::Future, B>,
E: NewSvcExec<IO, S::Future, S::Service, E, GracefulWatcher>,
{
/// Prepares a server to handle graceful shutdown when the provided future
@@ -209,7 +209,7 @@ where
S::Service: 'static,
B: Payload,
B::Data: Unpin,
E: H2Exec<<S::Service as Service<Body>>::Future, B>,
E: H2Exec<<S::Service as HttpService<Body>>::Future, B>,
E: NewSvcExec<IO, S::Future, S::Service, E, NoopWatcher>,
{
type Output = crate::Result<()>;
@@ -396,7 +396,7 @@ impl<I, E> Builder<I, E> {
B: Payload,
B::Data: Unpin,
E: NewSvcExec<I::Conn, S::Future, S::Service, E, NoopWatcher>,
E: H2Exec<<S::Service as Service<Body>>::Future, B>,
E: H2Exec<<S::Service as HttpService<Body>>::Future, B>,
{
let serve = self.protocol.serve(self.incoming, new_service);
let spawn_all = serve.spawn_all();