Derive Debug for Router instead of implementing manually (#463)

This commit is contained in:
david-perez 2021-11-04 12:35:50 +01:00 committed by GitHub
parent 071a1b26e6
commit a47d7eca40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,6 +62,7 @@ impl RouteId {
}
/// The router type for composing handlers and services.
#[derive(Debug)]
pub struct Router<B = Body> {
routes: HashMap<RouteId, Route<B>>,
node: Node,
@ -87,16 +88,6 @@ where
}
}
impl<B> fmt::Debug for Router<B> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Router")
.field("routes", &self.routes)
.field("node", &self.node)
.field("fallback", &self.fallback)
.finish()
}
}
pub(crate) const NEST_TAIL_PARAM: &str = "axum_nest";
const NEST_TAIL_PARAM_CAPTURE: &str = "/*axum_nest";