Module parallel

Module parallel 

Source
Expand description

Parallel file operations for concurrent processing of multiple files and directories.

This module provides async functions that perform file operations in parallel using Tokio’s thread pool. These functions are optimized for:

  • Processing multiple files or directories simultaneously
  • Avoiding blocking the async runtime with I/O operations
  • Scaling with available CPU cores

§Examples

use agpm_cli::utils::fs::parallel::copy_files_parallel;
use std::path::PathBuf;

let copy_operations = vec![
    (PathBuf::from("src/agent1.md"), PathBuf::from("output/agent1.md")),
    (PathBuf::from("src/agent2.md"), PathBuf::from("output/agent2.md")),
];

copy_files_parallel(&copy_operations).await?;
println!("All files copied successfully!");

Functions§

copy_dirs_parallel
Copies multiple directories concurrently.
copy_files_parallel
Copies multiple files concurrently using parallel processing.
read_files_parallel
Reads multiple files concurrently and returns their contents.