[][src]Struct jwalk::WalkDir

pub struct WalkDir { /* fields omitted */ }

Builder for walking a directory.

Methods

impl WalkDir[src]

pub fn new<P: AsRef<Path>>(root: P) -> Self[src]

Create a builder for a recursive directory iterator starting at the file path root. If root is a directory, then it is the first item yielded by the iterator. If root is a file, then it is the first and only item yielded by the iterator.

pub fn sort(self, sort: bool) -> Self[src]

Sort entries by file_name per directory. Defaults to false. Use process_entries for custom sorting or filtering.

pub fn skip_hidden(self, skip_hidden: bool) -> Self[src]

Skip hidden entries. Enabled by default.

pub fn preload_metadata(self, preload_metadata: bool) -> Self[src]

Preload metadata before yeilding entries. When running in parrallel the metadata is loaded in rayon's thread pool.

pub fn max_depth(self, depth: usize) -> Self[src]

Maximum depth of entries yielded by the iterator. 0 corresponds to the root path of this walk.

A depth < 2 will automatically change thread_count to 1. jwalks parrallelism happens at the fs::read_dir level. It only makes sense to use multiple threads when reading more then one directory.

pub fn num_threads(self, n: usize) -> Self[src]

  • 0 Use rayon global pool.
  • 1 Perform walk on calling thread.
  • n > 1 Construct a new rayon ThreadPool to perform the walk.

pub fn process_entries<F>(self, process_by: F) -> Self where
    F: Fn(&mut Vec<Result<DirEntry>>) + Send + Sync + 'static, 
[src]

A callback function to process (sort/filter/skip) each directory of entries before they are yeilded. From within this callback use entry.set_content_spec(None) to yeild that directory but skip descending into its contents.

Trait Implementations

impl IntoIterator for WalkDir[src]

type Item = Result<DirEntry>

The type of the elements being iterated over.

type IntoIter = DirEntryIter

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl Send for WalkDir

impl Sync for WalkDir

Blanket Implementations

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]