Skip to main content

ParallelWalker

Struct ParallelWalker 

Source
pub struct ParallelWalker { /* private fields */ }
Expand description

An adaptive parallel filesystem walker.

Broad root frontiers use low-overhead lane traversal. Narrow trees use dynamic directory scheduling so work below one top-level directory can use every worker. Link-following carries an immutable ancestry set with each directory task so aliases remain parallel without losing cycle detection.

Implementations§

Source§

impl ParallelWalker

Source

pub fn into_iter_ordered_bounded(self, capacity: usize) -> ParallelWalkIter

Starts bounded parallel traversal and yields entries in strict, deterministic depth-first order.

Directory reads are prefetched up to max_open and the configured parallelism. A capacity of zero is normalized to one.

§Panics

Panics if the coordinator thread cannot be created. Use Self::try_into_iter_ordered_bounded for fallible startup.

Source

pub fn try_into_iter_ordered_bounded( self, capacity: usize, ) -> Result<ParallelWalkIter>

Fallible form of Self::into_iter_ordered_bounded.

§Errors

Returns the coordinator thread spawn error.

Source§

impl ParallelWalker

Source

pub fn into_iter_bounded(self, capacity: usize) -> ParallelWalkIter

Starts parallel traversal with a bounded pull buffer.

A capacity of zero is normalized to one. Workers stop producing when the buffer is full until the consumer requests another item.

§Panics

Panics if the coordinator thread cannot be created. Use Self::try_into_iter_bounded for fallible startup.

Source

pub fn try_into_iter_bounded(self, capacity: usize) -> Result<ParallelWalkIter>

Fallible form of Self::into_iter_bounded.

This reports an operating-system thread creation failure instead of panicking before traversal starts.

§Errors

Returns the coordinator thread spawn error.

Source§

impl ParallelWalker

Source

pub fn visit<F>(self, visitor: F) -> Result<ParallelVisitReport, WalkError>
where F: for<'entry> Fn(WalkEvent<'entry>) -> WalkControl + Send + Sync + 'static,

Visits entries directly on traversal workers without collecting paths.

Visitor calls may run concurrently and their order is intentionally unspecified. Use Self::walk when deterministic collected order is required.

§Errors

Returns a root error or the first traversal error under ErrorPolicy::Abort.

§Panics

Panics if the visitor or an internal traversal worker panics.

Source

pub fn visit_with_cancellation<F>( self, cancellation: &CancellationToken, visitor: F, ) -> Result<ParallelVisitReport, WalkError>
where F: for<'entry> Fn(WalkEvent<'entry>) -> WalkControl + Send + Sync + 'static,

Streaming parallel traversal with cooperative cancellation.

§Errors

Returns a root error or the first traversal error under ErrorPolicy::Abort.

§Panics

Panics if the visitor or an internal traversal worker panics.

Source§

impl ParallelWalker

Source

pub fn new(root: impl Into<PathBuf>) -> Self

Source

pub const fn options(self, options: WalkOptions) -> Self

Source

pub const fn with_parallelism(self, parallelism: usize) -> Self

Sets worker count. Zero selects available parallelism.

Source

pub fn runtime(self, runtime: ParallelRuntime) -> Self

Selects the global, dedicated, or application-owned executor.

Source

pub fn skip_stdout(self, enabled: bool) -> Self

Skips a regular file that refers to redirected standard output.

This applies consistently to collected, visitor and pull APIs and prevents feedback loops when command output is written inside a walked tree.

Source

pub fn walk(self) -> Result<ParallelWalkReport, WalkError>

Walks the tree using bounded adaptive scheduling.

§Errors

With ErrorPolicy::Abort, returns the first observed local traversal error. With ErrorPolicy::Continue, local errors are collected.

§Panics

Panics if an internal worker panics or shared traversal state is poisoned.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.