@@ -7,6 +7,7 @@ use http_body::Body;
77use linkerd_error:: Error ;
88use linkerd_http_box:: BoxBody ;
99use linkerd_stack:: { self as svc, layer:: Layer , ExtractParam , NewService , Service } ;
10+ use std:: { future:: Future , pin:: Pin } ;
1011
1112/// A [`NewService<T>`] that creates [`RecordBodyData`] services.
1213#[ derive( Clone , Debug ) ]
@@ -63,16 +64,14 @@ where
6364impl < ReqB , RespB , S > Service < Request < ReqB > > for RecordBodyData < S >
6465where
6566 S : Service < Request < ReqB > , Response = Response < RespB > > ,
67+ S :: Future : Send + ' static ,
6668 RespB : Body + Send + ' static ,
6769 RespB :: Data : Send + ' static ,
6870 RespB :: Error : Into < Error > ,
6971{
7072 type Response = Response < BoxBody > ;
7173 type Error = S :: Error ;
72- type Future = futures:: future:: MapOk <
73- S :: Future ,
74- Box < dyn FnOnce ( Response < RespB > ) -> Self :: Response + Send + ' static > ,
75- > ;
74+ type Future = Pin < Box < dyn Future < Output = Result < Self :: Response , Self :: Error > > + Send > > ;
7675
7776 #[ inline]
7877 fn poll_ready (
@@ -83,13 +82,13 @@ where
8382 }
8483
8584 fn call ( & mut self , req : Request < ReqB > ) -> Self :: Future {
86- use futures:: TryFutureExt ;
85+ use futures:: { FutureExt , TryFutureExt } ;
8786
8887 let Self { inner, metrics } = self ;
8988 let metrics = metrics. clone ( ) ;
9089 let instrument = Box :: new ( |resp| Self :: instrument_response ( resp, metrics) ) ;
9190
92- inner. call ( req) . map_ok ( instrument)
91+ inner. call ( req) . map_ok ( instrument) . boxed ( )
9392 }
9493}
9594
0 commit comments