Router: allow to set match parameter name

This commit is contained in:
Dietmar Maurer 2018-11-16 08:29:23 +01:00
parent 2ab1f7119c
commit 484eb9ac19
2 changed files with 3 additions and 3 deletions

View File

@ -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<S>(mut self, param_name: S, router: Router) -> Self where S: Into<String> {
self.subroute = SubRoute::MatchAll { router: Box::new(router), param_name: param_name.into() };
self
}

View File

@ -58,7 +58,7 @@ pub fn router() -> Router {
});
let route = Router::new()
.match_all(route2);
.match_all("node", route2);
route
}