INNER CODE UNIT · Rust

default

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

    fn default() -> Self {
        Self::new("api/**/*.rs")
    }
}

impl From<Vec<&str>> for Router {
    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())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…