Skip to main content

map_ordered_concurrent

Function map_ordered_concurrent 

Source
pub async fn map_ordered_concurrent<I, T, F, Fut>(
    items: &[I],
    concurrency: usize,
    task: F,
) -> Result<Vec<T>, HttpError>
where I: Clone + Send, T: Send, F: Fn(I) -> Fut + Send + Sync + 'static, Fut: Future<Output = T> + Send,
Expand description

Runs task for every item with at most concurrency tasks at a time, each on its own thread. Results keep the order of items. A concurrency of zero counts as one. Returns HttpError::WorkerPanicked when a task panics.