(self, seq: A)
| 367 | } |
| 368 | |
| 369 | fn visit_seq<A>(self, seq: A) -> Result<Self::Value, A::Error> |
| 370 | where |
| 371 | A: serde::de::SeqAccess<'de>, |
| 372 | { |
| 373 | let routes: Vec<Route> = |
| 374 | Deserialize::deserialize(serde::de::value::SeqAccessDeserializer::new(seq))?; |
| 375 | |
| 376 | let mut inner = Router::new(); |
| 377 | let mut raw = Vec::new(); |
| 378 | |
| 379 | let mut routes_by_path = HashMap::new(); |
| 380 | |
| 381 | for route in &routes { |
| 382 | routes_by_path |
| 383 | .entry(route.path.clone()) |
| 384 | .and_modify(|routes| merge_routes(routes, route)) |
| 385 | .or_insert_with(|| decode_route(route)); |
| 386 | |
| 387 | raw.push(route.clone()); |
| 388 | } |
| 389 | |
| 390 | for (path, route) in &routes_by_path { |
| 391 | inner.insert(path, route.clone()).map_err(|e| { |
| 392 | serde::de::Error::custom(format!("Failed to insert route {path}: {e}")) |
| 393 | })?; |
| 394 | } |
| 395 | |
| 396 | Ok(FunctionRouter { inner, raw }) |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | fn merge_routes(routes: &mut FunctionRoutes, route: &Route) { |
nothing calls this directly
no test coverage detected