fn calculate_file_map(deps: &[String]) -> anyhow::Result<BTreeMap<String, PathBuf>> {
    static REX: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?m)module\s+(\w+)\s*\{").unwrap());
    let mut module_to_file = BTreeMap::new();
    for dep in deps {
        let dep_path = PathBuf::from(dep);
        for module in extract_matches(dep_path.as_path(), &*REX)? {
            module_to_file.insert(module, dep_path.clone());
        }
    }
    Ok(module_to_file)
}
/// Calculate a map of module names to files which define those modules.
Calculate a map of module names to files which define those modules.
Calculate a map of module names to files which define those modules .
fn calculate_file_map(deps: &[String]) -> anyhow::Result<BTreeMap<String, PathBuf>> {
    static REX: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?m)module\s+(\w+)\s*\{").unwrap());
    let mut module_to_file = BTreeMap::new();
    for dep in deps {
        let dep_path = PathBuf::from(dep);
        for module in extract_matches(dep_path.as_path(), &*REX)? {
            module_to_file.insert(module, dep_path.clone());
        }
    }
    Ok(module_to_file)
}
fn calculate_file_map ( deps : & [ String ] ) -> anyhow :: Result < BTreeMap < String , PathBuf > > { static REX : Lazy < Regex > = Lazy :: new ( | | Regex :: new ( r"(?m)module\s+(\w+)\s*\{" ) . unwrap ( ) ) ; let mut module_to_file = BTreeMap :: new ( ) ; for dep in deps { let dep_path = PathBuf :: from ( dep ) ; for module in extract_matches ( dep_path . as_path ( ) , & * REX ) ? { module_to_file . insert ( module , dep_path . clone ( ) ) ; } } Ok ( module_to_file ) }
Calculate a map of module names to files which define those modules.
Calculate a map of module names to files which define those modules .
deps
&[String]