Skip to main content

Diff

Struct Diff 

Source
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

Source

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());

Trait Implementations§

Source§

impl Clone for Diff

Source§

fn clone(&self) -> Diff

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Diff

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Diff

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Diff

Source§

fn eq(&self, other: &Diff) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Diff

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Diff

Auto Trait Implementations§

§

impl Freeze for Diff

§

impl RefUnwindSafe for Diff

§

impl Send for Diff

§

impl Sync for Diff

§

impl Unpin for Diff

§

impl UnsafeUnpin for Diff

§

impl UnwindSafe for Diff

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,