path-matchers
Every tool that watches, ignores or copies files ends up with a matcher: this extension is ignored, that directory is included. Writing it again in every project is how subtle bugs get in.
What changes for you
- One trait, two implementations. Compare a path to another path
or to a glob like
images/**/best.*through the same interface. - Composable. Combine matchers with
anyandallinstead of nesting conditions by hand. - Small dependency, no build-time surprises.
Getting it
cargo add path-matchersuse path_matchers::{glob, PathMatcher};
let best_images = glob("images/**/best.*")?;
assert!(best_images.matches(&PathBuf::from("images/small/32x32/best.jpg")));