pub fn map<U, E, F>(list: impl Iterator<Item = U>, func: F) -> SplitResult<T>
  where
    F: Fn(U) -> Result<T, E>,
    E: std::fmt::Display + std::fmt::Debug + Sync + Send + 'static,
  {
    let mut values = vec![];
    let mut group = ErrorGroup::new(None);
    for item in list {
      match func(item) {
        Ok(value) => values.push(value),
        Err(err) => group.append(anyhow!(err)),
      }
    }

    SplitResult {
      values,
      errors: match group.len() {
        0 => None,
        _ => Some(group),
      },
    }
  }
/// Apply a function to each value of an iterator, sorting successes from errors
///
// Similar to iterator.partition
Apply a function to each value of an iterator, sorting successes from errors
Similar to iterator.partition
Apply a function to each value of an iterator sorting successes from errors Similar to iterator . partition
pub fn map<U, E, F>(list: impl Iterator<Item = U>, func: F) -> SplitResult<T>
  where
    F: Fn(U) -> Result<T, E>,
    E: std::fmt::Display + std::fmt::Debug + Sync + Send + 'static,
  {
    let mut values = vec![];
    let mut group = ErrorGroup::new(None);
    for item in list {
      match func(item) {
        Ok(value) => values.push(value),
        Err(err) => group.append(anyhow!(err)),
      }
    }
    SplitResult {
      values,
      errors: match group.len() {
        0 => None,
        _ => Some(group),
      },
    }
  }
pub fn map < U , E , F > ( list : impl Iterator < Item = U > , func : F ) -> SplitResult < T > where F : Fn ( U ) -> Result < T , E > , E : std :: fmt :: Display + std :: fmt :: Debug + Sync + Send + ' static , { let mut values = vec ! [ ] ; let mut group = ErrorGroup :: new ( None ) ; for item in list { match func ( item ) { Ok ( value ) => values . push ( value ) , Err ( err ) => group . append ( anyhow ! ( err ) ) , } } SplitResult { values , errors : match group . len ( ) { 0 => None , _ => Some ( group ) , } , } }
Apply a function to each value of an iterator, sorting successes from errors
Similar to iterator.partition
Apply a function to each value of an iterator sorting successes from errors Similar to iterator . partition
list
impl Iterator<Item = U>
func
F
list
impl Iterator<Item = U>
func
F