Skip to main content

collect_files

Function collect_files 

Source
pub fn collect_files(path: &Path, options: &WalkOptions) -> Vec<PathBuf>
Expand description

Get all files matching the given options as a Vec

This is a convenience function that collects the walker results into a vector.

§Arguments

  • path - Root path to start walking from
  • options - WalkOptions containing filtering criteria

§Returns

A vector of PathBuf objects pointing to matching files

§Examples

use codesearch::fs::{collect_files, WalkOptions};
use std::path::Path;

let options = WalkOptions {
    extensions: Some(vec!["rs".to_string()]),
    ..Default::default()
};

let rust_files = collect_files(Path::new("./src"), &options);
println!("Found {} Rust files", rust_files.len());