miden-crypto/src/utils/diff.rs
src/utils/diff.rsRaw
1/// A trait for computing the difference between two objects.
2pub trait Diff<K: Ord + Clone, V: Clone> {
3 type DiffType;
4
5 /// Returns a `Self::DiffType` object that represents the difference between this object and
6 /// other.
7 fn diff(&self, other: &Self) -> Self::DiffType;
8}
9
10/// A trait for applying the difference between two objects.
11pub trait ApplyDiff<K: Ord + Clone, V: Clone> {
12 type DiffType;
13
14 /// Applies the provided changes described by [DiffType] to the object implementing this trait.
15 fn apply(&mut self, diff: Self::DiffType);
16}