Skip to main content

WalkBuilder

Struct WalkBuilder 

Source
pub struct WalkBuilder { /* private fields */ }
Expand description

Configures flexible single- or multi-root walking.

Implementations§

Source§

impl WalkBuilder

Source

pub fn new(root: impl Into<PathBuf>) -> Self

Source

pub fn add_root(self, root: impl Into<PathBuf>) -> Self

Source

pub const fn options(self, options: WalkOptions) -> Self

Source

pub fn sort_by_file_name(self) -> Self

Sorts each directory by its native file name before descent.

Source

pub fn sort_by<F>(self, compare: F) -> Self
where F: Fn(&DirEntry, &DirEntry) -> Ordering + Send + Sync + 'static,

Sorts each directory with a comparator over complete directory entries.

Source

pub fn sort_by_name<F>(self, compare: F) -> Self
where F: Fn(&OsStr, &OsStr) -> Ordering + Send + Sync + 'static,

Sorts with a native-name comparator without lossy UTF-8 conversion.

Source

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.

Source

pub const fn contents_first(self, enabled: bool) -> Self

Emits a directory after all accepted descendants.

Source

pub fn filter_entry<F>(self, filter: F) -> Self
where F: Fn(&WalkEntry) -> bool + Send + Sync + 'static,

Filters entries before emission and prunes rejected directories.

Source

pub fn filter_directories<F>(self, filter: F) -> Self
where F: Fn(&WalkEntry) -> bool + Send + Sync + 'static,

Invokes a directory predicate before descent; files remain accepted.

Source

pub fn filter_directories_stateful<F>(self, filter: F) -> Self
where F: FnMut(&WalkEntry) -> bool + Send + 'static,

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.

Source

pub fn build(self) -> MultiWalker

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.