Router: implement missing builder methods

This commit is contained in:
Dietmar Maurer 2018-11-16 08:24:10 +01:00
parent fc937099b3
commit 2ab1f7119c
1 changed files with 15 additions and 0 deletions

View File

@ -52,6 +52,21 @@ impl Router {
self
}
pub fn put(mut self, m: ApiMethod) -> Self {
self.put = Some(m);
self
}
pub fn post(mut self, m: ApiMethod) -> Self {
self.post = Some(m);
self
}
pub fn delete(mut self, m: ApiMethod) -> Self {
self.delete = Some(m);
self
}
pub fn find_route(&self, components: &[&str]) -> Option<&Router> {
if components.len() == 0 { return Some(self); };