INNER CODE UNIT · Rust

from

vercel-community/rust · crates/vercel_runtime_router/src/lib.rs:181

    fn from(raw_paths: Vec<&str>) -> Self {
        let mut routes: Vec<Route> = raw_paths.into_iter().map(Route::from).collect();
        routes.sort();
        Router { routes }
    }
}

impl Router {
    pub fn new(file_pattern: &str) -> Self {
        let mut routes = glob(file_pattern)
            .expect("Failed to read glob pattern")
            .filter_map(|e| e.ok())
            .map(|raw_path| {
                let path = raw_path.to_str().unwrap();
                Route::from(path)
            })
            .collect::<Vec<_>>();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…