[−][src]Struct jwalk::WalkDirGeneric
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.
pub fn follow_links(self, follow_links: bool) -> Self
[src]
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]
F: Fn(Option<usize>, &Path, &mut C::ReadDirState, &mut Vec<Result<DirEntry<C>>>) + Send + Sync + 'static,
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?
pub fn into_iter(self) -> DirEntryIter<C>ⓘNotable traits for DirEntryIter<C>
impl<C: ClientState> Iterator for DirEntryIter<C> type Item = Result<DirEntry<C>>;
[src]
Notable traits for DirEntryIter<C>
impl<C: ClientState> Iterator for DirEntryIter<C> type Item = Result<DirEntry<C>>;
Auto Trait Implementations
impl<C> !RefUnwindSafe for WalkDirGeneric<C>
[src]
impl<C> Send for WalkDirGeneric<C> where
<C as ClientState>::ReadDirState: Send,
[src]
<C as ClientState>::ReadDirState: Send,
impl<C> Sync for WalkDirGeneric<C> where
<C as ClientState>::ReadDirState: Sync,
[src]
<C as ClientState>::ReadDirState: Sync,
impl<C> Unpin for WalkDirGeneric<C> where
<C as ClientState>::ReadDirState: Unpin,
[src]
<C as ClientState>::ReadDirState: Unpin,
impl<C> !UnwindSafe for WalkDirGeneric<C>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,