From 484eb9ac19aca7eac65b8f75f449009379c90de0 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 16 Nov 2018 08:29:23 +0100 Subject: [PATCH] Router: allow to set match parameter name --- src/api/router.rs | 4 ++-- src/api3.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/router.rs b/src/api/router.rs index 41b922e5..2af43141 100644 --- a/src/api/router.rs +++ b/src/api/router.rs @@ -42,8 +42,8 @@ impl Router { self } - pub fn match_all(mut self, router: Router) -> Self { - self.subroute = SubRoute::MatchAll { router: Box::new(router), param_name: "test".into() }; + pub fn match_all(mut self, param_name: S, router: Router) -> Self where S: Into { + self.subroute = SubRoute::MatchAll { router: Box::new(router), param_name: param_name.into() }; self } diff --git a/src/api3.rs b/src/api3.rs index 805e3414..605cf27c 100644 --- a/src/api3.rs +++ b/src/api3.rs @@ -58,7 +58,7 @@ pub fn router() -> Router { }); let route = Router::new() - .match_all(route2); + .match_all("node", route2); route }