Skip to content

Commit cd2d1b9

Browse files
committed
review: Box <RecordBodyData as Service>::Future values
Signed-off-by: katelyn martin <[email protected]>
1 parent 1da2206 commit cd2d1b9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

linkerd/http/prom/src/body_data/response.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use http_body::Body;
77
use linkerd_error::Error;
88
use linkerd_http_box::BoxBody;
99
use 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
6364
impl<ReqB, RespB, S> Service<Request<ReqB>> for RecordBodyData<S>
6465
where
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

Comments
 (0)