pub fn traverse_with_progress<T, U, Env, F, Eff>(
items: Vec<T>,
stage_name: &str,
f: F,
) -> impl Effect<Output = Vec<U>, Error = AnalysisError, Env = Env>Expand description
Traverse items with automatic progress reporting.
This combinator processes items sequentially, reporting progress after each item completes. The stage is automatically started at the beginning and completed at the end.
§Arguments
items- The items to processstage_name- The name of the stage for progress reportingf- A function that creates an effect for each item
§Returns
An effect that produces a vector of results.
§Example
ⓘ
let files = vec!["a.rs", "b.rs", "c.rs"];
let effect = traverse_with_progress(
files,
"File Analysis",
|path| analyze_file_effect(path)
);
// Progress: File Analysis 0/3, 1/3, 2/3, 3/3
let results = effect.run(&env).await?;§Error Handling
If any item fails, the traversal stops and returns the error. The stage is still completed for proper cleanup.