Function flatten_join_named_results

Source
pub fn flatten_join_named_results<T, E1, E2, S, R>(
    task_results: R,
) -> Result<(), BridgeError>
where R: IntoIterator<Item = (S, Result<Result<T, E1>, E2>)>, S: AsRef<str>, E1: Display, E2: Display,
Expand description

Collects all errors (both outer and inner) from named task results and returns a combined error if any task failed.

This function is useful when you have multiple async tasks (e.g., from tokio::spawn) and want to see all errors if multiple tasks fail, rather than just the first error.

§Parameters

  • task_results: Iterator of tuples containing (task_name, Result<Result<T, E1>, E2>)
    • task_name: A string-like identifier for the task (used in error messages)
    • The nested Result represents: Result<T, E1> is the task’s result, E2 is typically a JoinError

§Returns

  • Ok(()) if all tasks completed successfully
  • Err(BridgeError) with a combined error message listing all failures