Add unique future types for all services (#157)

So we can more easily change them in the future.
This commit is contained in:
David Pedersen
2021-08-07 22:27:27 +02:00
committed by GitHub
parent 2389761ce7
commit 6ce355cca3
7 changed files with 106 additions and 14 deletions
+5 -3
View File
@@ -617,19 +617,21 @@ where
{
type Response = Response<BoxBody>;
type Error = Infallible;
type Future = RouteFuture<S, F, B>;
type Future = future::OnMethodFuture<S, F, B>;
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: Request<B>) -> Self::Future {
if self.method.matches(req.method()) {
let f = if self.method.matches(req.method()) {
let fut = self.svc.clone().oneshot(req);
RouteFuture::a(fut)
} else {
let fut = self.fallback.clone().oneshot(req);
RouteFuture::b(fut)
}
};
future::OnMethodFuture { inner: f }
}
}