use super::FinalRunResult; pub use iter::*; pub trait CoalescingRunner<'c> { /// Run all the commands in this iterator, and coalesce the results into /// one error (if any individual commands failed) fn run_and_coalesce(self) -> Vec>; } #[cfg(not(feature = "rayon"))] mod iter { use super::*; use crate::{argument_parsing::Globals, cargo_command::*, run::run_and_convert}; pub fn into_iter(var: T) -> impl Iterator { var.into_iter() } impl<'g, 'c, I> CoalescingRunner<'c> for I where I: Iterator, bool)>, { fn run_and_coalesce(self) -> Vec> { self.map(run_and_convert).collect() } } } #[cfg(feature = "rayon")] mod iter { use super::*; use crate::{argument_parsing::Globals, cargo_command::*, run::run_and_convert}; use rayon::prelude::*; pub fn into_iter(var: T) -> impl ParallelIterator { var.into_par_iter() } impl<'g, 'c, I> CoalescingRunner<'c> for I where I: ParallelIterator, bool)>, { fn run_and_coalesce(self) -> Vec> { self.map(run_and_convert).collect() } } }