()
| 31 | struct ReloadSignal; |
| 32 | |
| 33 | fn read_routes() -> Vec<ast::Route> { |
| 34 | let mut routes = Vec::new(); |
| 35 | for entry in WalkDir::new("routes") |
| 36 | .contents_first(true) |
| 37 | .into_iter() |
| 38 | .filter_entry(|e| { |
| 39 | e.file_type().is_file() |
| 40 | && e.file_name() |
| 41 | .to_str() |
| 42 | .map(|s| s.ends_with(".ai")) |
| 43 | .unwrap_or(false) |
| 44 | }) |
| 45 | .filter_map(|e| e.ok()) |
| 46 | { |
| 47 | let file_path = entry.path(); |
| 48 | if let Some(route) = read_single_route(file_path) { |
| 49 | routes.push(route); |
| 50 | } |
| 51 | } |
| 52 | routes |
| 53 | } |
| 54 | |
| 55 | fn read_single_route(file_path: &Path) -> Option<ast::Route> { |
| 56 | match fs::read_to_string(file_path) { |
no test coverage detected