Skip to main content

ParallelWalker

Struct ParallelWalker 

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

A breadth-oriented parallel walker for wide repository trees.

Top-level directories are distributed across bounded serial walkers. This keeps the serial Walker API streaming and gives broad trees an explicit parallel mode without making scanner output order nondeterministic. Worker completion order does not affect report order. Callers that need a cross-filesystem stable manifest must still sort, as Scanner does. Link-following falls back to the serial walker so cycle detection has one authoritative seen set.

Implementations§

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 walk(self) -> Result<ParallelWalkReport, WalkError>

Walks the tree using bounded top-level parallelism.

§Errors

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

§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.