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

@@ -7,7 +7,7 @@ use crate::body::{Body, Payload};
use crate::common::drain::{self, Draining, Signal, Watch, Watching};
use crate::common::exec::{H2Exec, NewSvcExec};
use crate::common::{Future, Pin, Poll, Unpin, task};
use crate::service::{MakeServiceRef, Service};
use crate::service::{MakeServiceRef, HttpService};
use super::Accept;
use super::conn::{SpawnAll, UpgradeableConnection, Watcher};
@@ -55,7 +55,7 @@ where
B: Payload,
B::Data: Unpin,
F: Future<Output=()>,
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>,
{
type Output = crate::Result<()>;
@@ -106,7 +106,7 @@ pub struct GracefulWatcher(Watch);
impl<I, S, E> Watcher<I, S, E> for GracefulWatcher
where
I: AsyncRead + AsyncWrite + Unpin + Send + 'static,
S: Service<Body> + 'static,
S: HttpService<Body> + 'static,
<S::ResBody as Payload>::Data: Unpin,
E: H2Exec<S::Future, S::ResBody>,
{
@@ -122,7 +122,7 @@ where
fn on_drain<I, S, E>(conn: Pin<&mut UpgradeableConnection<I, S, E>>)
where
S: Service<Body>,
S: HttpService<Body>,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
I: AsyncRead + AsyncWrite + Unpin,
S::ResBody: Payload + 'static,