walkr 0.1.0

Recursively search a directory for files matching a regex, and execute a closure you define. This tiny crate allows you to find and operate on files quickly, making it convenient to quickly write tools performing file processing in Rust.
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 6.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 295.12 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 33s Average build duration of successful builds.
  • all releases: 33s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • wikiwong/walkr
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wikiwong

walkr

walkr recursively searches a directory for files matching a regex, and executes a closure you define, taking in a &DirEntry. This tiny crate allows you to find and operate on files quickly, making it convenient to quickly write tools performing file processing in Rust.

Usage

match walkr::find(Path::new("./"), &"\\.rs".to_owned(), &|d| {
  println!("File: {:?} matched!", d.file_name().into_string().unwrap());
  
  // open the file and print the contents to stdout
  let mut f = File::open(d.path()).unwrap();
  let mut s = String::new();
  match f.read_to_string(&mut s) {
    Ok(_) => {
      println!("{:?}", s);
    },
    Err(e) => panic!(e)
  }
}) {
  Ok(_) => println!("done"),
  Err(e) => panic!(e)
}

Running this example:

cargo run ./src \.rs