Struct jwalk::WalkDirGeneric

source ·
pub struct WalkDirGeneric<C: ClientState> { /* private fields */ }
Expand description

Generic builder for walking a directory.

ClientState type parameter allows you to specify state to be stored with each DirEntry from within the process_read_dir callback.

Use WalkDir if you don’t need to store client state into yeilded DirEntries.

Implementations§

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.

Note that his iterator can fail on the first element if into_iter() is used as it has to be infallible. Use try_into_iter() instead for error handling.

Try to create an iterator or fail if the rayon threadpool (in any configuration) is busy.

Root path of the walk.

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

Skip hidden entries. Enabled by default.

Follow symbolic links. By default, this is disabled.

When yes is true, symbolic links are followed as if they were normal directories and files. If a symbolic link is broken or is involved in a loop, an error is yielded.

When enabled, the yielded DirEntry values represent the target of the link while the path corresponds to the link. See the DirEntry type for more details.

Set the minimum depth of entries yielded 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.

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.

A depth < 2 will automatically change parallelism to Parallelism::Serial. Parrallelism happens at the fs::read_dir level. It only makes sense to use multiple threads when reading more then one directory.

Note that this will not simply filter the entries of the iterator, but it will actually avoid descending into directories when the depth is exceeded.

Degree of parallelism to use when performing walk. Defaults to Parallelism::RayonDefaultPool.

Initial ClientState::ReadDirState that is passed to process_read_dir when processing root. Defaults to ClientState::ReadDirState::default().

A callback function to process (sort/filter/skip/state) each directory of entries before they are yielded. Modify the given array to sort/filter entries. Use entry.read_children_path = None to yield a directory entry but skip reading its contents. Use entry.client_state to store custom state with an entry.

Trait Implementations§

The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.