mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-20 00:00:11 +02:00
Add unique future types for all services (#157)
So we can more easily change them in the future.
This commit is contained in:
+5
-3
@@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user