Here's a recursive file list:
$find src
src/
src/main.rs
src/a/
src/a/b.rs
Running this program
extern crate glob;
use std::path::Path;
use glob::{Pattern,glob};
fn main() {
let pattern="src/*.rs";
println!("matches src/a/b.rs: {}",Pattern::new(pattern).unwrap().matches_path(Path::new("src/a/b.rs")));
for entry in glob(pattern).unwrap() {
println!("globbed: {}", entry.unwrap().display());
}
}
outputs
matches src/a/b.rs: true
globbed: src/main.rs
Note it DID NOT output globbed: src/a/b.rs. Meaning glob and Pattern::matches_path are inconsistent here. I think glob is correct as '*' should not match across slashes.
Here's a recursive file list:
Running this program
outputs
Note it DID NOT output
globbed: src/a/b.rs. MeaningglobandPattern::matches_pathare inconsistent here. I thinkglobis correct as '*' should not match across slashes.