pub struct WalkBuilder { /* private fields */ }Expand description
Configures flexible single- or multi-root walking.
Implementations§
Source§impl WalkBuilder
impl WalkBuilder
pub fn new(root: impl Into<PathBuf>) -> Self
pub fn add_root(self, root: impl Into<PathBuf>) -> Self
pub const fn options(self, options: WalkOptions) -> Self
Sourcepub fn sort_by_file_name(self) -> Self
pub fn sort_by_file_name(self) -> Self
Sorts each directory by its native file name before descent.
Sourcepub fn sort_by<F>(self, compare: F) -> Self
pub fn sort_by<F>(self, compare: F) -> Self
Sorts each directory with a comparator over complete directory entries.
Sourcepub fn sort_by_name<F>(self, compare: F) -> Self
pub fn sort_by_name<F>(self, compare: F) -> Self
Sorts with a native-name comparator without lossy UTF-8 conversion.
Sourcepub fn skip_stdout(self, enabled: bool) -> Self
pub fn skip_stdout(self, enabled: bool) -> Self
Skips a regular file that refers to redirected standard output.
This prevents feedback loops such as scanning a tree while writing command output into a file inside that same tree.
Sourcepub const fn contents_first(self, enabled: bool) -> Self
pub const fn contents_first(self, enabled: bool) -> Self
Emits a directory after all accepted descendants.
Sourcepub fn filter_entry<F>(self, filter: F) -> Self
pub fn filter_entry<F>(self, filter: F) -> Self
Filters entries before emission and prunes rejected directories.
Sourcepub fn filter_directories<F>(self, filter: F) -> Self
pub fn filter_directories<F>(self, filter: F) -> Self
Invokes a directory predicate before descent; files remain accepted.
Sourcepub fn filter_directories_stateful<F>(self, filter: F) -> Self
pub fn filter_directories_stateful<F>(self, filter: F) -> Self
Invokes one mutable directory predicate across every configured root.
The callback is serialized behind a mutex so captured state remains coherent if builder internals gain concurrent root traversal later.