ito_core/validate/
report.rs1use super::{ValidationIssue, ValidationReport};
7
8#[derive(Debug, Default)]
9pub struct ReportBuilder {
11 strict: bool,
12 issues: Vec<ValidationIssue>,
13}
14
15impl ReportBuilder {
16 pub fn new(strict: bool) -> Self {
18 Self {
19 strict,
20 issues: Vec::new(),
21 }
22 }
23
24 pub fn push(&mut self, issue: ValidationIssue) {
26 self.issues.push(issue);
27 }
28
29 pub fn extend<I>(&mut self, issues: I)
31 where
32 I: IntoIterator<Item = ValidationIssue>,
33 {
34 self.issues.extend(issues);
35 }
36
37 pub fn finish(self) -> ValidationReport {
39 ValidationReport::new(self.issues, self.strict)
40 }
41}
42
43pub fn report(strict: bool) -> ReportBuilder {
45 ReportBuilder::new(strict)
46}