Struct fast_walker::WalkPlan
source · pub struct WalkPlan {
pub check_list: Vec<PathBuf>,
pub follow_symlinks: bool,
pub depth_first: bool,
pub threads: usize,
pub reject_when: fn(_: &Path, _: usize) -> bool,
pub ignore_when: fn(_: OsString) -> bool,
pub finish_when: fn(_: &WalkItem) -> bool,
}Fields§
§check_list: Vec<PathBuf>Initial paths to search
follow_symlinks: boolFollow symlinks
depth_first: boolDepth first search or breadth first search
threads: usizeNumber of threads to use
reject_when: fn(_: &Path, _: usize) -> boolCheck if a directory should be rejected
ignore_when: fn(_: OsString) -> bool§finish_when: fn(_: &WalkItem) -> boolStop if a item matches the condition
Implementations§
source§impl WalkPlan
impl WalkPlan
sourcepub fn roots<I>(roots: I) -> Selfwhere
I: IntoIterator,
I::Item: AsRef<Path>,
pub fn roots<I>(roots: I) -> Selfwhere I: IntoIterator, I::Item: AsRef<Path>,
Create a new plan with initial paths
sourcepub fn breadth_first_search(self) -> Self
pub fn breadth_first_search(self) -> Self
Search all subdirectories with breadth first
sourcepub fn depth_first_search(self) -> Self
pub fn depth_first_search(self) -> Self
Search all subdirectories with depth first
sourcepub fn with_threads(self, threads: usize) -> Self
pub fn with_threads(self, threads: usize) -> Self
Search with threads
sourcepub fn reject_if(self, f: fn(_: &Path, _: usize) -> bool) -> Self
pub fn reject_if(self, f: fn(_: &Path, _: usize) -> bool) -> Self
Reject directories if it matches the condition
Examples
- ignore hidden directories
let plan = WalkPlan::new(".").reject_if(|path, _| path.starts_with("."));sourcepub fn ignore_if(self, f: fn(_: OsString) -> bool) -> Self
pub fn ignore_if(self, f: fn(_: OsString) -> bool) -> Self
Ignore files if it’s name matches the condition
Notice that it does not ignore directories whose name matches the condition
Examples
- ignore non-ascii files
let plan = WalkPlan::new(".").ignore_if(|path| !path.is_ascii());