pub struct Diff {
pub newly_failing: Vec<String>,
pub newly_passing: Vec<String>,
pub severity_changes: Vec<SeverityChange>,
pub duration_regressions: Vec<DurationRegression>,
pub added: Vec<String>,
pub removed: Vec<String>,
}Expand description
Result of comparing two Reports.
All vectors are sorted alphabetically by check name so two diffs of
the same input pair produce equal Diff values.
§Example
use dev_report::{CheckResult, Report, Severity};
let mut prev = Report::new("crate", "0.1.0");
prev.push(CheckResult::pass("a"));
prev.push(CheckResult::pass("b"));
let mut curr = Report::new("crate", "0.1.0");
curr.push(CheckResult::pass("a"));
curr.push(CheckResult::fail("b", Severity::Error));
curr.push(CheckResult::pass("c"));
let diff = curr.diff(&prev);
assert_eq!(diff.newly_failing, vec!["b".to_string()]);
assert_eq!(diff.added, vec!["c".to_string()]);Fields§
§newly_failing: Vec<String>Checks that are Fail in current but were not Fail in baseline
(or did not exist in baseline).
newly_passing: Vec<String>Checks that are Pass in current but were not Pass in baseline.
severity_changes: Vec<SeverityChange>Severity transitions for checks present in both reports.
duration_regressions: Vec<DurationRegression>Duration regressions for checks present in both reports, where the slowdown exceeds the configured threshold.
added: Vec<String>Checks present in current but not in baseline.
removed: Vec<String>Checks present in baseline but not in current.
Implementations§
Source§impl Diff
impl Diff
Sourcepub fn is_clean(&self) -> bool
pub fn is_clean(&self) -> bool
true if the diff contains no differences worth flagging.
§Example
use dev_report::{CheckResult, Report};
let mut a = Report::new("c", "0.1.0");
a.push(CheckResult::pass("x"));
let b = a.clone();
assert!(a.diff(&b).is_clean());Sourcepub fn summary(&self) -> String
pub fn summary(&self) -> String
One-line summary of the diff suitable for log output or CI status.
Returns "clean" when is_clean is true; otherwise
returns a comma-separated list of non-empty categories with counts,
e.g. "2 newly failing, 1 added, 1 duration regression".
§Example
use dev_report::{CheckResult, Report, Severity};
// Identical reports -> "clean"
let mut a = Report::new("c", "0.1.0");
a.push(CheckResult::pass("x"));
assert_eq!(a.diff(&a).summary(), "clean");
// Mixed differences -> comma-separated counts.
let mut prev = Report::new("c", "0.1.0");
prev.push(CheckResult::pass("a"));
let mut curr = Report::new("c", "0.1.0");
curr.push(CheckResult::fail("a", Severity::Error));
let s = curr.diff(&prev).summary();
assert!(s.contains("1 newly failing"));
assert!(s.contains("1 severity change"));