pub struct MultiReport {
pub schema_version: u32,
pub subject: String,
pub subject_version: String,
pub started_at: DateTime<Utc>,
pub finished_at: Option<DateTime<Utc>>,
pub reports: Vec<Report>,
}Expand description
Aggregate of multiple Reports emitted in a single run.
Identity of a check is (producer, name). Two checks with the same
name from different producers are kept separate.
§Example
use dev_report::{CheckResult, MultiReport, Report, Severity, Verdict};
let mut bench = Report::new("crate", "0.1.0").with_producer("dev-bench");
bench.push(CheckResult::pass("hot_path"));
let mut chaos = Report::new("crate", "0.1.0").with_producer("dev-chaos");
chaos.push(CheckResult::fail("recover", Severity::Error));
let mut multi = MultiReport::new("crate", "0.1.0");
multi.push(bench);
multi.push(chaos);
multi.finish();
assert_eq!(multi.overall_verdict(), Verdict::Fail);
assert_eq!(multi.total_check_count(), 2);Fields§
§schema_version: u32Schema version. Tracks the same number as Report::schema_version.
subject: StringCrate or project being reported on.
subject_version: StringVersion of the subject.
started_at: DateTime<Utc>When aggregation started.
finished_at: Option<DateTime<Utc>>When aggregation finished, if known.
reports: Vec<Report>Constituent reports.
Implementations§
Source§impl MultiReport
impl MultiReport
Sourcepub fn new(
subject: impl Into<String>,
subject_version: impl Into<String>,
) -> Self
pub fn new( subject: impl Into<String>, subject_version: impl Into<String>, ) -> Self
Begin a new aggregate for the given subject and version.
Examples found in repository?
101fn build_multi() -> MultiReport {
102 let frozen_start = chrono::Utc.with_ymd_and_hms(2026, 5, 11, 12, 0, 0).unwrap();
103 let frozen_end = chrono::Utc
104 .with_ymd_and_hms(2026, 5, 11, 12, 0, 10)
105 .unwrap();
106 let mut m = MultiReport::new("sample-subject", "0.9.3");
107 m.started_at = frozen_start;
108 m.push(build_report("dev-bench"));
109 m.push(build_report("dev-chaos"));
110 m.finished_at = Some(frozen_end);
111 m
112}Sourcepub fn push(&mut self, r: Report)
pub fn push(&mut self, r: Report)
Append a constituent report.
Examples found in repository?
101fn build_multi() -> MultiReport {
102 let frozen_start = chrono::Utc.with_ymd_and_hms(2026, 5, 11, 12, 0, 0).unwrap();
103 let frozen_end = chrono::Utc
104 .with_ymd_and_hms(2026, 5, 11, 12, 0, 10)
105 .unwrap();
106 let mut m = MultiReport::new("sample-subject", "0.9.3");
107 m.started_at = frozen_start;
108 m.push(build_report("dev-bench"));
109 m.push(build_report("dev-chaos"));
110 m.finished_at = Some(frozen_end);
111 m
112}Sourcepub fn overall_verdict(&self) -> Verdict
pub fn overall_verdict(&self) -> Verdict
Compute the overall verdict across every check in every report.
Follows the same precedence as Report::overall_verdict:
Fail > Warn > Pass > Skip.
Sourcepub fn total_check_count(&self) -> usize
pub fn total_check_count(&self) -> usize
Total number of checks across all constituent reports.
Sourcepub fn iter_reports(&self) -> impl Iterator<Item = &Report>
pub fn iter_reports(&self) -> impl Iterator<Item = &Report>
Iterate over the constituent reports.
Equivalent to self.reports.iter() but reads cleaner at the
call site and makes the public iteration API explicit.
§Example
use dev_report::{CheckResult, MultiReport, Report};
let mut bench = Report::new("c", "0.1.0").with_producer("dev-bench");
bench.push(CheckResult::pass("hot"));
let mut multi = MultiReport::new("c", "0.1.0");
multi.push(bench);
for r in multi.iter_reports() {
assert_eq!(r.subject, "c");
}Sourcepub fn report_from(&self, producer: &str) -> Option<&Report>
pub fn report_from(&self, producer: &str) -> Option<&Report>
Find the constituent report from a specific producer, if any.
Returns the first match (MultiReport doesn’t enforce
uniqueness; producers can appear multiple times).
§Example
use dev_report::{CheckResult, MultiReport, Report};
let mut bench = Report::new("c", "0.1.0").with_producer("dev-bench");
bench.push(CheckResult::pass("hot"));
let mut multi = MultiReport::new("c", "0.1.0");
multi.push(bench);
let found = multi.report_from("dev-bench").unwrap();
assert_eq!(found.checks.len(), 1);Sourcepub fn verdict_counts(&self) -> (usize, usize, usize, usize)
pub fn verdict_counts(&self) -> (usize, usize, usize, usize)
Aggregate verdict counts across all constituent reports as
(pass, fail, warn, skip).
§Example
use dev_report::{CheckResult, MultiReport, Report, Severity};
let mut a = Report::new("c", "0.1.0").with_producer("a");
a.push(CheckResult::pass("x"));
a.push(CheckResult::fail("y", Severity::Error));
let mut b = Report::new("c", "0.1.0").with_producer("b");
b.push(CheckResult::pass("z"));
let mut multi = MultiReport::new("c", "0.1.0");
multi.push(a);
multi.push(b);
assert_eq!(multi.verdict_counts(), (2, 1, 0, 0));Sourcepub fn iter_checks(&self) -> impl Iterator<Item = (Option<&str>, &CheckResult)>
pub fn iter_checks(&self) -> impl Iterator<Item = (Option<&str>, &CheckResult)>
Iterate over every check across every constituent report, paired with the producer that emitted it.
Producers without a producer field are emitted as None.
Sourcepub fn checks_with_tag<'a>(
&'a self,
tag: &'a str,
) -> impl Iterator<Item = (Option<&'a str>, &'a CheckResult)>
pub fn checks_with_tag<'a>( &'a self, tag: &'a str, ) -> impl Iterator<Item = (Option<&'a str>, &'a CheckResult)>
Iterate over checks carrying the given tag, paired with their producer.
§Example
use dev_report::{CheckResult, MultiReport, Report};
let mut bench = Report::new("c", "0.1.0").with_producer("dev-bench");
bench.push(CheckResult::pass("hot").with_tag("slow"));
bench.push(CheckResult::pass("cold"));
let mut multi = MultiReport::new("c", "0.1.0");
multi.push(bench);
let slow: Vec<_> = multi.checks_with_tag("slow").collect();
assert_eq!(slow.len(), 1);
assert_eq!(slow[0].0, Some("dev-bench"));Sourcepub fn to_json(&self) -> Result<String>
pub fn to_json(&self) -> Result<String>
Serialize this multi-report to JSON.
Examples found in repository?
114fn main() {
115 let arg = std::env::args()
116 .nth(1)
117 .unwrap_or_else(|| "report".to_string());
118 let json = match arg.as_str() {
119 "multi" => build_multi().to_json().expect("serialize MultiReport"),
120 _ => build_report("dev-bench")
121 .to_json()
122 .expect("serialize Report"),
123 };
124 println!("{}", json);
125}Sourcepub fn passed(&self) -> bool
pub fn passed(&self) -> bool
true when overall_verdict is Pass.
Sourcepub fn failed(&self) -> bool
pub fn failed(&self) -> bool
true when overall_verdict is Fail.
Sourcepub fn warned(&self) -> bool
pub fn warned(&self) -> bool
true when overall_verdict is Warn.
Sourcepub fn skipped(&self) -> bool
pub fn skipped(&self) -> bool
true when overall_verdict is Skip.
Sourcepub fn checks_with_severity(
&self,
severity: Severity,
) -> impl Iterator<Item = (Option<&str>, &CheckResult)>
pub fn checks_with_severity( &self, severity: Severity, ) -> impl Iterator<Item = (Option<&str>, &CheckResult)>
Iterate over checks with the given severity, paired with their producer.
§Example
use dev_report::{CheckResult, MultiReport, Report, Severity};
let mut bench = Report::new("c", "0.1.0").with_producer("dev-bench");
bench.push(CheckResult::fail("a", Severity::Error));
let mut multi = MultiReport::new("c", "0.1.0");
multi.push(bench);
let errors: Vec<_> = multi.checks_with_severity(Severity::Error).collect();
assert_eq!(errors.len(), 1);Sourcepub fn to_terminal(&self) -> String
Available on crate feature terminal only.
pub fn to_terminal(&self) -> String
terminal only.Render this multi-report to a TTY-friendly string. Monochrome.
Available with the terminal feature.
Sourcepub fn to_terminal_color(&self) -> String
Available on crate feature terminal only.
pub fn to_terminal_color(&self) -> String
terminal only.Render this multi-report with ANSI color codes.
Available with the terminal feature.
Sourcepub fn to_markdown(&self) -> String
Available on crate feature markdown only.
pub fn to_markdown(&self) -> String
markdown only.Render this multi-report to a Markdown string.
Available with the markdown feature.
Sourcepub fn to_sarif(&self) -> String
Available on crate feature sarif only.
pub fn to_sarif(&self) -> String
sarif only.Render this multi-report as a SARIF 2.1.0 document.
Each constituent Report becomes its own SARIF run, so
consumers can tell which producer emitted which finding. Only
Fail and Warn checks are emitted.
Available with the sarif feature.
Sourcepub fn to_junit_xml(&self) -> String
Available on crate feature junit only.
pub fn to_junit_xml(&self) -> String
junit only.Render this multi-report as a JUnit XML document with one
<testsuite> per constituent Report.
Available with the junit feature.
Trait Implementations§
Source§impl Clone for MultiReport
impl Clone for MultiReport
Source§fn clone(&self) -> MultiReport
fn clone(&self) -> MultiReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more