/// Walks multiple directories recursively in parallel and sends found files to `consumer`.
/// Input paths can be relative to the current working directory,
/// but produced paths are absolute.
/// The `consumer` must be able to receive items from many threads.
/// Inaccessible files are skipped, but errors are printed to stderr.
/// The order of files is not specified and may be different every time.
Walks multiple directories recursively in parallel and sends found files to `consumer`.
Input paths can be relative to the current working directory,
but produced paths are absolute.
The `consumer` must be able to receive items from many threads.
Inaccessible files are skipped, but errors are printed to stderr.
The order of files is not specified and may be different every time.
Walks multiple directories recursively in parallel and sends found files to ` consumer ` . Input paths can be relative to the current working directory but produced paths are absolute . The ` consumer ` must be able to receive items from many threads . Inaccessible files are skipped but errors are printed to stderr . The order of files is not specified and may be different every time .
pub fn run<I, F>(&self, roots: I, consumer: F)
    where
        I: IntoIterator<Item = Path> + Send,
        F: Fn(Path) + Sync + Send,
    {
        let state = WalkState {
            consumer,
            visited: DashSet::new(),
        };
        rayon::scope(|scope| {
            for p in roots.into_iter() {
                let p = self.absolute(p);
                match fs::metadata(&p.to_path_buf()) {
                    Ok(metadata) if metadata.is_dir() && self.depth == 0 => self.log_warn(format!(
                        "Skipping directory {} because recursive scan is disabled.",
                        p
                    )),
                    _ => scope.spawn(|scope| self.visit_path(p, scope, 0, &state)),
                }
            }
        });
    }
pub fn run < I , F > ( & self , roots : I , consumer : F ) where I : IntoIterator < Item = Path > + Send , F : Fn ( Path ) + Sync + Send , { let state = WalkState { consumer , visited : DashSet :: new ( ) , } ; rayon :: scope ( | scope | { for p in roots . into_iter ( ) { let p = self . absolute ( p ) ; match fs :: metadata ( & p . to_path_buf ( ) ) { Ok ( metadata ) if metadata . is_dir ( ) && self . depth == 0 => self . log_warn ( format ! ( " " p ) ) , _ => scope . spawn ( | scope | self . visit_path ( p , scope , 0 , & state ) ) , } } } ) ; }
Walks multiple directories recursively in parallel and sends found files to `consumer`.
Walks multiple directories recursively in parallel and sends found files to ` consumer ` .
&self
roots
I
consumer
F