@@ -26,7 +26,7 @@ use crate::common::io::Rewind;
26
26
use crate :: common:: { Future , Pin , Poll , Unpin , task} ;
27
27
use crate :: error:: { Kind , Parse } ;
28
28
use crate :: proto;
29
- use crate :: service:: { MakeServiceRef , Service } ;
29
+ use crate :: service:: { MakeServiceRef , HttpService } ;
30
30
use crate :: upgrade:: Upgraded ;
31
31
use super :: Accept ;
32
32
@@ -117,7 +117,7 @@ pub(super) struct SpawnAll<I, S, E> {
117
117
#[ pin_project]
118
118
pub struct Connection < T , S , E = Exec >
119
119
where
120
- S : Service < Body > ,
120
+ S : HttpService < Body > ,
121
121
{
122
122
pub ( super ) conn : Option < Either <
123
123
proto:: h1:: Dispatcher <
@@ -356,13 +356,13 @@ impl<E> Http<E> {
356
356
///
357
357
/// ```
358
358
/// # use hyper::{Body, Request, Response};
359
- /// # use hyper::service::Service ;
359
+ /// # use hyper::service::HttpService ;
360
360
/// # use hyper::server::conn::Http;
361
361
/// # use tokio_io::{AsyncRead, AsyncWrite};
362
362
/// # async fn run<I, S>(some_io: I, some_service: S)
363
363
/// # where
364
364
/// # I: AsyncRead + AsyncWrite + Unpin + Send + 'static,
365
- /// # S: Service <Body, ResBody=Body> + Send + 'static,
365
+ /// # S: HttpService <Body, ResBody=Body> + Send + 'static,
366
366
/// # S::Future: Send
367
367
/// # {
368
368
/// let http = Http::new();
@@ -376,7 +376,7 @@ impl<E> Http<E> {
376
376
/// ```
377
377
pub fn serve_connection < S , I , Bd > ( & self , io : I , service : S ) -> Connection < I , S , E >
378
378
where
379
- S : Service < Body , ResBody =Bd > ,
379
+ S : HttpService < Body , ResBody =Bd > ,
380
380
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
381
381
Bd : Payload ,
382
382
Bd :: Data : Unpin ,
@@ -431,8 +431,9 @@ impl<E> Http<E> {
431
431
ResBody =Bd ,
432
432
> ,
433
433
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
434
+ S :: Service : HttpService < Body > ,
434
435
Bd : Payload ,
435
- E : H2Exec < <S :: Service as Service < Body > >:: Future , Bd > ,
436
+ E : H2Exec < <S :: Service as HttpService < Body > >:: Future , Bd > ,
436
437
{
437
438
let mut incoming = AddrIncoming :: new ( addr, None ) ?;
438
439
if self . keep_alive {
@@ -454,7 +455,7 @@ impl<E> Http<E> {
454
455
> ,
455
456
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
456
457
Bd : Payload ,
457
- E : H2Exec < <S :: Service as Service < Body > >:: Future , Bd > ,
458
+ E : H2Exec < <S :: Service as HttpService < Body > >:: Future , Bd > ,
458
459
{
459
460
let mut incoming = AddrIncoming :: new ( addr, Some ( handle) ) ?;
460
461
if self . keep_alive {
@@ -477,7 +478,7 @@ impl<E> Http<E> {
477
478
> ,
478
479
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
479
480
Bd : Payload ,
480
- E : H2Exec < <S :: Service as Service < Body > >:: Future , Bd > ,
481
+ E : H2Exec < <S :: Service as HttpService < Body > >:: Future , Bd > ,
481
482
{
482
483
Serve {
483
484
incoming,
@@ -498,7 +499,7 @@ impl<E> Http<E> {
498
499
> ,
499
500
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
500
501
Bd : Payload ,
501
- E : H2Exec < <S :: Service as Service < Body > >:: Future , Bd > ,
502
+ E : H2Exec < <S :: Service as HttpService < Body > >:: Future , Bd > ,
502
503
{
503
504
Serve {
504
505
incoming,
@@ -513,7 +514,7 @@ impl<E> Http<E> {
513
514
514
515
impl < I , B , S , E > Connection < I , S , E >
515
516
where
516
- S : Service < Body , ResBody =B > ,
517
+ S : HttpService < Body , ResBody =B > ,
517
518
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
518
519
I : AsyncRead + AsyncWrite + Unpin ,
519
520
B : Payload + ' static ,
@@ -662,7 +663,7 @@ where
662
663
663
664
impl < I , B , S , E > Future for Connection < I , S , E >
664
665
where
665
- S : Service < Body , ResBody =B > ,
666
+ S : HttpService < Body , ResBody =B > ,
666
667
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
667
668
I : AsyncRead + AsyncWrite + Unpin + ' static ,
668
669
B : Payload + ' static ,
@@ -700,7 +701,7 @@ where
700
701
701
702
impl < I , S > fmt:: Debug for Connection < I , S >
702
703
where
703
- S : Service < Body > ,
704
+ S : HttpService < Body > ,
704
705
{
705
706
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
706
707
f. debug_struct ( "Connection" )
@@ -740,7 +741,7 @@ where
740
741
IE : Into < Box < dyn StdError + Send + Sync > > ,
741
742
S : MakeServiceRef < IO , Body , ResBody =B > ,
742
743
B : Payload ,
743
- E : H2Exec < <S :: Service as Service < Body > >:: Future , B > ,
744
+ E : H2Exec < <S :: Service as HttpService < Body > >:: Future , B > ,
744
745
{
745
746
fn poll_next_ ( self : Pin < & mut Self > , cx : & mut task:: Context < ' _ > ) -> Poll < Option < crate :: Result < Connecting < IO , S :: Future , E > > > > {
746
747
let me = self . project ( ) ;
@@ -774,7 +775,7 @@ where
774
775
IE : Into < Box < dyn StdError + Send + Sync > > ,
775
776
S : MakeServiceRef < IO , Body , ResBody =B > ,
776
777
B : Payload ,
777
- E : H2Exec < <S :: Service as Service < Body > >:: Future , B > ,
778
+ E : H2Exec < <S :: Service as HttpService < Body > >:: Future , B > ,
778
779
{
779
780
type Item = crate :: Result < Connecting < IO , S :: Future , E > > ;
780
781
@@ -790,7 +791,7 @@ impl<I, F, S, FE, E, B> Future for Connecting<I, F, E>
790
791
where
791
792
I : AsyncRead + AsyncWrite + Unpin ,
792
793
F : Future < Output =Result < S , FE > > ,
793
- S : Service < Body , ResBody =B > ,
794
+ S : HttpService < Body , ResBody =B > ,
794
795
B : Payload ,
795
796
B :: Data : Unpin ,
796
797
E : H2Exec < S :: Future , B > ,
@@ -831,7 +832,7 @@ where
831
832
ResBody =B ,
832
833
> ,
833
834
B : Payload ,
834
- E : H2Exec < <S :: Service as Service < Body > >:: Future , B > ,
835
+ E : H2Exec < <S :: Service as HttpService < Body > >:: Future , B > ,
835
836
{
836
837
pub ( super ) fn poll_watch < W > ( self : Pin < & mut Self > , cx : & mut task:: Context < ' _ > , watcher : & W ) -> Poll < crate :: Result < ( ) > >
837
838
where
@@ -875,7 +876,7 @@ pub(crate) mod spawn_all {
875
876
use crate :: body:: { Body , Payload } ;
876
877
use crate :: common:: exec:: H2Exec ;
877
878
use crate :: common:: { Future , Pin , Poll , Unpin , task} ;
878
- use crate :: service:: Service ;
879
+ use crate :: service:: HttpService ;
879
880
use super :: { Connecting , UpgradeableConnection } ;
880
881
use pin_project:: { pin_project, project} ;
881
882
@@ -887,7 +888,7 @@ pub(crate) mod spawn_all {
887
888
// The `Server::with_graceful_shutdown` needs to keep track of all active
888
889
// connections, and signal that they start to shutdown when prompted, so
889
890
// it has a `GracefulWatcher` implementation to do that.
890
- pub trait Watcher < I , S : Service < Body > , E > : Clone {
891
+ pub trait Watcher < I , S : HttpService < Body > , E > : Clone {
891
892
type Future : Future < Output = crate :: Result < ( ) > > ;
892
893
893
894
fn watch ( & self , conn : UpgradeableConnection < I , S , E > ) -> Self :: Future ;
@@ -900,7 +901,7 @@ pub(crate) mod spawn_all {
900
901
impl < I , S , E > Watcher < I , S , E > for NoopWatcher
901
902
where
902
903
I : AsyncRead + AsyncWrite + Unpin + Send + ' static ,
903
- S : Service < Body > + ' static ,
904
+ S : HttpService < Body > + ' static ,
904
905
<S :: ResBody as Payload >:: Data : Unpin ,
905
906
E : H2Exec < S :: Future , S :: ResBody > ,
906
907
{
@@ -923,18 +924,18 @@ pub(crate) mod spawn_all {
923
924
924
925
#[ pin_project]
925
926
#[ allow( missing_debug_implementations) ]
926
- pub struct NewSvcTask < I , N , S : Service < Body > , E , W : Watcher < I , S , E > > {
927
+ pub struct NewSvcTask < I , N , S : HttpService < Body > , E , W : Watcher < I , S , E > > {
927
928
#[ pin]
928
929
state : State < I , N , S , E , W > ,
929
930
}
930
931
931
932
#[ pin_project]
932
- pub enum State < I , N , S : Service < Body > , E , W : Watcher < I , S , E > > {
933
+ pub enum State < I , N , S : HttpService < Body > , E , W : Watcher < I , S , E > > {
933
934
Connecting ( #[ pin] Connecting < I , N , E > , W ) ,
934
935
Connected ( #[ pin] W :: Future ) ,
935
936
}
936
937
937
- impl < I , N , S : Service < Body > , E , W : Watcher < I , S , E > > NewSvcTask < I , N , S , E , W > {
938
+ impl < I , N , S : HttpService < Body > , E , W : Watcher < I , S , E > > NewSvcTask < I , N , S , E , W > {
938
939
pub ( super ) fn new ( connecting : Connecting < I , N , E > , watcher : W ) -> Self {
939
940
NewSvcTask {
940
941
state : State :: Connecting ( connecting, watcher) ,
@@ -947,7 +948,7 @@ pub(crate) mod spawn_all {
947
948
I : AsyncRead + AsyncWrite + Unpin + Send + ' static ,
948
949
N : Future < Output =Result < S , NE > > ,
949
950
NE : Into < Box < dyn StdError + Send + Sync > > ,
950
- S : Service < Body , ResBody =B > ,
951
+ S : HttpService < Body , ResBody =B > ,
951
952
B : Payload ,
952
953
B :: Data : Unpin ,
953
954
E : H2Exec < S :: Future , B > ,
@@ -1008,14 +1009,14 @@ mod upgrades {
1008
1009
#[ allow( missing_debug_implementations) ]
1009
1010
pub struct UpgradeableConnection < T , S , E >
1010
1011
where
1011
- S : Service < Body > ,
1012
+ S : HttpService < Body > ,
1012
1013
{
1013
1014
pub ( super ) inner : Connection < T , S , E > ,
1014
1015
}
1015
1016
1016
1017
impl < I , B , S , E > UpgradeableConnection < I , S , E >
1017
1018
where
1018
- S : Service < Body , ResBody =B > , // + 'static,
1019
+ S : HttpService < Body , ResBody =B > , // + 'static,
1019
1020
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
1020
1021
I : AsyncRead + AsyncWrite + Unpin ,
1021
1022
B : Payload + ' static ,
@@ -1033,7 +1034,7 @@ mod upgrades {
1033
1034
1034
1035
impl < I , B , S , E > Future for UpgradeableConnection < I , S , E >
1035
1036
where
1036
- S : Service < Body , ResBody =B > + ' static ,
1037
+ S : HttpService < Body , ResBody =B > + ' static ,
1037
1038
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
1038
1039
I : AsyncRead + AsyncWrite + Unpin + Send + ' static ,
1039
1040
B : Payload + ' static ,
0 commit comments