@@ -15,6 +15,7 @@ use bytes::Bytes;
15
15
use dupe:: Dupe ;
16
16
use futures:: StreamExt ;
17
17
use futures:: TryStreamExt ;
18
+ use futures:: future:: BoxFuture ;
18
19
use futures:: stream:: BoxStream ;
19
20
use http:: Method ;
20
21
use http:: Uri ;
@@ -23,7 +24,6 @@ use http::uri::Scheme;
23
24
use hyper:: Body ;
24
25
use hyper:: Request ;
25
26
use hyper:: Response ;
26
- use hyper:: client:: ResponseFuture ;
27
27
use hyper:: client:: connect:: Connect ;
28
28
use tokio:: io:: AsyncReadExt ;
29
29
use tokio_util:: io:: StreamReader ;
@@ -204,15 +204,17 @@ impl HttpClient {
204
204
/// ProxyConnector<HttpsConnector<..>>, etc); thus wrap the client so we can switch
205
205
/// out the concrete type without exposing implementation details to callers.
206
206
pub ( super ) trait RequestClient : Send + Sync {
207
- fn request ( & self , request : Request < Bytes > ) -> ResponseFuture ;
207
+ fn request ( & self , request : Request < Bytes > ) -> ResponseFuture < ' _ > ;
208
208
}
209
209
210
+ type ResponseFuture < ' a > = BoxFuture < ' a , hyper:: Result < Response < Body > > > ;
211
+
210
212
impl < C > RequestClient for hyper:: Client < C >
211
213
where
212
214
C : Connect + Clone + Send + Sync + ' static ,
213
215
{
214
- fn request ( & self , request : Request < Bytes > ) -> ResponseFuture {
215
- self . request ( request. map ( Body :: from) )
216
+ fn request ( & self , request : Request < Bytes > ) -> ResponseFuture < ' _ > {
217
+ Box :: pin ( self . request ( request. map ( Body :: from) ) )
216
218
}
217
219
}
218
220
0 commit comments