Skip to main content

validate_each

Function validate_each 

Source
pub fn validate_each<F>(
    segments: &[Segment<'_>],
    report: &mut ValidationReport,
    f: F,
)
where F: FnMut(&Segment<'_>) -> Result<(), EdifactError>,
Expand description

Helper for per-segment validators: iterates segments, calls f for each one, and converts any Err into report entries.

Use this in validate_batch implementations that work segment-by-segment:

fn validate_batch(&self, segments: &[Segment<'_>], report: &mut ValidationReport) {
    validate_each(segments, report, |seg| { /* ... */ Ok(()) });
}