Skip to main content

Diff

Trait Diff 

Source
pub trait Diff: Sized {
    type Diff: DiffInfo;

    // Required method
    fn diff(old: &Self, new: &Self) -> Self::Diff;
}
Expand description

Compute a structural diff between two values of the same type.

The diff type Self::Diff captures what changed between old and new.

Required Associated Types§

Source

type Diff: DiffInfo

The diff representation for this type.

Required Methods§

Source

fn diff(old: &Self, new: &Self) -> Self::Diff

Compute the diff from old to new.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Diff for Void

Source§

impl Diff for Unit

Source§

impl<H: Diff, T: Diff> Diff for Product<H, T>

Source§

type Diff = ProductDiff<<H as Diff>::Diff, <T as Diff>::Diff>

Source§

impl<L: Diff + Clone, R: Diff + Clone> Diff for Sum<L, R>

Source§

type Diff = SumDiff<<L as Diff>::Diff, <R as Diff>::Diff, L, R>

Source§

impl<T> Diff for T
where T: LeafDiff + Clone + PartialEq,

Blanket leaf-level diff: compare via PartialEq, delta is the new value.

Source§

impl<T: Diff> Diff for Field<T>

Source§

type Diff = <T as Diff>::Diff

Source§

impl<T: Diff> Diff for Variant<T>

Source§

type Diff = <T as Diff>::Diff