use walkdir::WalkDir; pub mod manifest; fn main() { let file = std::fs::read_to_string("./test.toml").unwrap(); let x: manifest::Manifest = toml::from_str(&file).unwrap(); let rules = x .rules .iter() .map(|rule| (rule.regex(), rule.action)) .collect::>(); let walker = WalkDir::new("./target").into_iter(); for entry in walker { let e = entry.unwrap(); let p = e.path(); let s = p.to_str().unwrap(); if !p.is_file() { continue; } let m = rules .iter() .find(|(r, _)| r.is_match(s)) .map(|x| x.1.clone()); println!(" {m:?} {s}") } }