pub struct StatefulWalkBuilder<R, E> { /* private fields */ }Expand description
Builder for an iterative DFS walk with per-directory and per-entry state.
R is cloned from a processed directory into each accepted child
directory. E is attached independently to every yielded entry.
Implementations§
Source§impl<R, E> StatefulWalkBuilder<R, E>
impl<R, E> StatefulWalkBuilder<R, E>
pub fn new(root: impl Into<PathBuf>, root_read_dir_state: R) -> Self
pub const fn options(self, options: WalkOptions) -> Self
Sourcepub const fn with_parallelism(self, parallelism: usize) -> Self
pub const fn with_parallelism(self, parallelism: usize) -> Self
Sets parallel directory workers. Zero selects runtime parallelism.
Sourcepub fn runtime(self, runtime: ParallelRuntime) -> Self
pub fn runtime(self, runtime: ParallelRuntime) -> Self
Selects the executor used by parallel stateful traversal.
Sourcepub fn process_read_dir<F>(self, processor: F) -> Self
pub fn process_read_dir<F>(self, processor: F) -> Self
Processes the complete immediate child batch before entries are yielded.
The callback may sort or retain the vector, remove local errors, mutate
the inherited read-directory state, attach state to entries, and call
StatefulWalkEntry::set_read_children for per-entry pruning.
Sourcepub fn build(self) -> Result<StatefulWalker<R, E>, WalkError>
pub fn build(self) -> Result<StatefulWalker<R, E>, WalkError>
Builds the stateful iterator after validating the root.
§Errors
Returns an error when the root cannot be resolved or inspected.
Sourcepub fn build_parallel_ordered(
self,
capacity: usize,
) -> Result<ParallelStatefulWalker<E>, WalkError>
pub fn build_parallel_ordered( self, capacity: usize, ) -> Result<ParallelStatefulWalker<E>, WalkError>
Builds a bounded parallel iterator with strict depth-first output.
Directory callbacks run on the selected executor over complete child batches. Their mutated directory state is cloned into accepted child tasks, while yielded entries retain callback-assigned entry state.
§Errors
Returns a root-validation, coordinator-startup, or worker-submission error.