[go: up one dir, main page]

[][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 max_depth(self, depth: usize) -> Self[src]

Set the maximum depth of entries yield by the iterator.

The smallest depth is 0 and always corresponds to the path given to the new function on this type. Its direct descendents have depth 1, and their descendents have depth 2, and so on.

Note that a depth < 2 will automatically change thread_count to 1. jwalks parrallelism happens at the fs::read_dir level, so it only makes sense to use multiple threads when reading more then one directory.

pub fn sort(self, sort: Option<Sort>) -> Self[src]

Sort entries per directory. Use process_entries for custom sorting or filtering.

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 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 process_entries<F>(self, process_by: F) -> Self where
    F: Fn(&mut Vec<Result<DirEntry>>) + Send + Sync + 'static, 
[src]

Set a function to process (sort/filter/skip) each directory of entries before they are yeilded. Use entry.set_children_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]