Skip to main content

GlobWalk

Struct GlobWalk 

Source
pub struct GlobWalk<'a, F: Filesystem, A: GlobMatchAction<F>> {
    pub fs: &'a F,
    pub matcher: &'a GlobMatcher,
    pub candidate_prefix: &'static str,
    pub workspace_prefix: String,
    pub action: &'a A,
}
Expand description

Per-glob walk state: holds every immutable input the recursion needs, so the recursive methods take only the changing parts.

Fields§

§fs: &'a F

Filesystem the walker reads directory entries and follows symlinks through.

§matcher: &'a GlobMatcher

Compiled glob matcher.

§candidate_prefix: &'static str

Either "/" (workspace-absolute glob) or "" (project-relative glob). Prepended to the joined walk-relative segments to form the candidate string fed to the matcher.

§workspace_prefix: String

Either "" (workspace-absolute glob, or implicit-mode project) or "/seg1/seg2" (project-relative glob in a nested project). Prepended (followed by "/") to the joined walk-relative segments to form an entry’s workspace_absolute_path.

§action: &'a A

Per-match action: emits one GlobMatchAction::Output per matched file and owns the consumer’s error vocabulary.

Implementations§

Source§

impl<F: Filesystem, A: GlobMatchAction<F>> GlobWalk<'_, F, A>

Source

pub fn walk( &self, walk_dir: &Path, walk_rel: &mut Vec<String>, out: &mut Vec<A::Output>, ) -> Result<(), A::Error>

Recursively walk walk_dir, descending into subdirectories and following symlinks; invoke GlobMatchAction::on_match for every regular-file entry whose joined walk-relative path matches the configured glob.

walk_rel is the path of the walker relative to the original walk origin, expressed as a stack of UTF-8 segment strings. The walker pushes and pops in lock-step with the recursion so the same buffer threads through every level.

§Errors

Returns the action’s error type (via GlobMatchAction::map_walk_error or GlobMatchAction::on_match) if a directory read, a symlink metadata follow, or the per-match work fails.

Auto Trait Implementations§

§

impl<'a, F, A> Freeze for GlobWalk<'a, F, A>

§

impl<'a, F, A> RefUnwindSafe for GlobWalk<'a, F, A>

§

impl<'a, F, A> Send for GlobWalk<'a, F, A>
where F: Sync, A: Sync,

§

impl<'a, F, A> Sync for GlobWalk<'a, F, A>
where F: Sync, A: Sync,

§

impl<'a, F, A> Unpin for GlobWalk<'a, F, A>

§

impl<'a, F, A> UnsafeUnpin for GlobWalk<'a, F, A>

§

impl<'a, F, A> UnwindSafe for GlobWalk<'a, F, A>

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V