pub fn collect_errors<E, I>(errors: I) -> Validated<E, ()>where
E: Clone,
I: IntoIterator<Item = E>,Expand description
Converts multiple errors into a single Validated containing all errors.
This function takes an iterator of errors and creates a Validated::Invalid
containing all of them. This is useful for collecting errors from multiple
validation steps.
§Type Parameters
E: The error typeI: The iterator type
§Arguments
errors: An iterator of errors to collect
§Examples
use rustica::error::collect_errors;
use rustica::datatypes::validated::Validated;
let errors = vec!["error1", "error2", "error3"];
let validated: Validated<&str, ()> = collect_errors(errors);
assert!(validated.is_invalid());
assert_eq!(validated.errors().len(), 3);