[][src]Struct jwalk::WalkDirGeneric

pub struct WalkDirGeneric<C: ClientState> { /* fields omitted */ }

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

impl<C: ClientState> WalkDirGeneric<C>[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 root(&self) -> &Path[src]

Root path of the walk.

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

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

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

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.

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

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.

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.

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.

pub fn parallelism(self, parallelism: Parallelism) -> Self[src]

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

pub fn root_read_dir_state(self, read_dir_state: C::ReadDirState) -> Self[src]

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

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

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

impl<C: ClientState> IntoIterator for WalkDirGeneric<C>[src]

type Item = Result<DirEntry<C>>

The type of the elements being iterated over.

type IntoIter = DirEntryIter<C>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<C> !RefUnwindSafe for WalkDirGeneric<C>[src]

impl<C> Send for WalkDirGeneric<C> where
    <C as ClientState>::ReadDirState: Send
[src]

impl<C> Sync for WalkDirGeneric<C> where
    <C as ClientState>::ReadDirState: Sync
[src]

impl<C> Unpin for WalkDirGeneric<C> where
    <C as ClientState>::ReadDirState: Unpin
[src]

impl<C> !UnwindSafe for WalkDirGeneric<C>[src]

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.