| 253 | |
| 254 | impl FunctionRouter { |
| 255 | pub fn at( |
| 256 | &self, |
| 257 | path: &str, |
| 258 | method: &str, |
| 259 | ) -> Result<(String, HashMap<String, String>), MatchError> { |
| 260 | let matched = self.inner.at(path)?; |
| 261 | let function = matched.value.at(method).ok_or(MatchError::NotFound)?; |
| 262 | |
| 263 | let params = matched |
| 264 | .params |
| 265 | .iter() |
| 266 | .map(|(k, v)| (k.to_string(), v.to_string())) |
| 267 | .collect(); |
| 268 | |
| 269 | Ok((function.to_string(), params)) |
| 270 | } |
| 271 | |
| 272 | pub fn insert(&mut self, path: &str, routes: FunctionRoutes) -> Result<(), InsertError> { |
| 273 | self.inner.insert(path, routes) |