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 to_terminal(&self) -> String
Available on crate feature terminal only.
pub fn to_terminal(&self) -> String
terminal only.Render this diff as 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 diff 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 diff to a Markdown string.
Available with the markdown feature.