file_prefix_filter

Macro file_prefix_filter 

Source
macro_rules! file_prefix_filter {
    ($vis:vis $name:ident, $file_prefix:literal) => { ... };
}
Expand description

Creates a Filter type that only allows files / folders with a specific prefix.

ยงExamples

use std::path::Path;
use dir_structure::dir_children::Filter;

dir_structure::file_prefix_filter!(LogFile, "log");

assert!(LogFile::allows(Path::new("log.txt")));
assert!(LogFile::allows(Path::new("log")));
assert!(LogFile::allows(Path::new("log.log")));
assert!(LogFile::allows(Path::new("src/a/b/log.txt")));
assert!(!LogFile::allows(Path::new("src/a/b/file.txt")));