pub async fn run_concurrent_batch_with_progress<T, R, F, Fut, P>(
items: Vec<T>,
concurrency: usize,
job_fn: impl Fn(T) -> Fut + Send + Sync + Clone + 'static,
progress_fn: impl Fn(usize, &R) + Send + Sync + Clone + 'static,
) -> Vec<R>Expand description
Runs a batch of operations with progress reporting.
Similar to run_concurrent_batch, but also reports progress through a callback function.
This is useful for long-running operations where you want to update a progress bar
or log periodic status updates.
§Type Parameters
T- The input item typeR- The result typeF- The function type that processes each itemFut- The future type returned by the functionP- The progress callback function type
§Arguments
items- Vector of items to processconcurrency- Maximum number of concurrent operationsjob_fn- Function that processes each item and returns a futureprogress_fn- Callback function called after each item is processed
§Returns
A vector containing the results of all operations in the same order as the input items.