pub fn process_files_batch<P, F, R>(paths: &[P], processor: F) -> Vec<R>Expand description
Process multiple files in batch with optional parallelism
§Parallel Processing (CLI builds)
When the parallel feature is enabled (default), this function uses rayon
to process files across multiple CPU cores. The number of threads is
automatically determined by rayon based on available cores.
§Sequential Processing (Worker builds)
When the parallel feature is disabled (e.g., for Cloudflare Workers),
files are processed sequentially in a single thread. This avoids
SharedArrayBuffer requirements and ensures compatibility with edge runtimes.
§Example
ⓘ
let paths = vec![
PathBuf::from("src/main.rs"),
PathBuf::from("src/lib.rs"),
];
let results = process_files_batch(&paths, |path| {
std::fs::read_to_string(path).unwrap()
});