Skip to main content

StatefulWalkBuilder

Struct StatefulWalkBuilder 

Source
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>
where R: Clone + Send + 'static, E: Default + Send + 'static,

Source

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

Source

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

Source

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

Sets parallel directory workers. Zero selects runtime parallelism.

Source

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

Selects the executor used by parallel stateful traversal.

Source

pub fn process_read_dir<F>(self, processor: F) -> Self
where F: Fn(usize, &Path, &mut R, &mut Vec<Result<StatefulWalkEntry<E>, WalkError>>) + Send + Sync + 'static,

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<R, E> !RefUnwindSafe for StatefulWalkBuilder<R, E>

§

impl<R, E> !UnwindSafe for StatefulWalkBuilder<R, E>

§

impl<R, E> Freeze for StatefulWalkBuilder<R, E>
where R: Freeze,

§

impl<R, E> Send for StatefulWalkBuilder<R, E>
where R: Send,

§

impl<R, E> Sync for StatefulWalkBuilder<R, E>
where R: Sync,

§

impl<R, E> Unpin for StatefulWalkBuilder<R, E>
where R: Unpin,

§

impl<R, E> UnsafeUnpin for StatefulWalkBuilder<R, E>
where R: UnsafeUnpin,

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.