pub fn validate<E, Func>(value: T, tests: impl Iterator<Item = Func>) -> BatchResult<T>
  where
    Func: FnOnce(&T) -> Result<(), E>,
    E: Into<AnyhowError>,
  {
    let mut errors = ErrorGroup::new(None);
    let mut count = 0;
    for test in tests {
      count += 1;
      if let Err(err) = test(&value) {
        errors.append(err.into())
      };
    }

    BatchResult {
      count,
      value: value,
      errors,
    }
  }
/// Run the value through a list of tests and add failures to the result
Run the value through a list of tests and add failures to the result
Run the value through a list of tests and add failures to the result
pub fn validate<E, Func>(value: T, tests: impl Iterator<Item = Func>) -> BatchResult<T>
  where
    Func: FnOnce(&T) -> Result<(), E>,
    E: Into<AnyhowError>,
  {
    let mut errors = ErrorGroup::new(None);
    let mut count = 0;
    for test in tests {
      count += 1;
      if let Err(err) = test(&value) {
        errors.append(err.into())
      };
    }
    BatchResult {
      count,
      value: value,
      errors,
    }
  }
pub fn validate < E , Func > ( value : T , tests : impl Iterator < Item = Func > ) -> BatchResult < T > where Func : FnOnce ( & T ) -> Result < ( ) , E > , E : Into < AnyhowError > , { let mut errors = ErrorGroup :: new ( None ) ; let mut count = 0 ; for test in tests { count += 1 ; if let Err ( err ) = test ( & value ) { errors . append ( err . into ( ) ) } ; } BatchResult { count , value : value , errors , } }
Run the value through a list of tests and add failures to the result
Run the value through a list of tests and add failures to the result
value
T
tests
impl Iterator<Item = Func>
value
T
tests
impl Iterator<Item = Func>