mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-26 00:00:23 +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:
+6
-4
@@ -1,6 +1,6 @@
|
||||
//! Routing between [`Service`]s.
|
||||
|
||||
use self::future::{BoxRouteFuture, EmptyRouterFuture, RouteFuture};
|
||||
use self::future::{BoxRouteFuture, EmptyRouterFuture, NestedFuture, RouteFuture};
|
||||
use crate::{
|
||||
body::{box_body, BoxBody},
|
||||
buffer::MpscBuffer,
|
||||
@@ -898,7 +898,7 @@ where
|
||||
{
|
||||
type Response = Response<BoxBody>;
|
||||
type Error = S::Error;
|
||||
type Future = RouteFuture<S, F, B>;
|
||||
type Future = NestedFuture<S, F, B>;
|
||||
|
||||
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
@@ -910,7 +910,7 @@ where
|
||||
req.extensions_mut().insert(original_uri);
|
||||
}
|
||||
|
||||
if let Some((prefix, captures)) = self.pattern.prefix_match(req.uri().path()) {
|
||||
let f = if let Some((prefix, captures)) = self.pattern.prefix_match(req.uri().path()) {
|
||||
let without_prefix = strip_prefix(req.uri(), prefix);
|
||||
*req.uri_mut() = without_prefix;
|
||||
|
||||
@@ -920,7 +920,9 @@ where
|
||||
} else {
|
||||
let fut = self.fallback.clone().oneshot(req);
|
||||
RouteFuture::b(fut)
|
||||
}
|
||||
};
|
||||
|
||||
NestedFuture { inner: f }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user