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 FFilesystem the walker reads directory entries and follows symlinks through.
matcher: &'a GlobMatcherCompiled glob matcher.
candidate_prefix: &'static strEither "/" (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: StringEither "" (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 APer-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>
impl<F: Filesystem, A: GlobMatchAction<F>> GlobWalk<'_, F, A>
Sourcepub fn walk(
&self,
walk_dir: &Path,
walk_rel: &mut Vec<String>,
out: &mut Vec<A::Output>,
) -> Result<(), A::Error>
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.