}
}
impl<A, B> Diffable for (A, B)
where
A: Diffable,
B: Diffable,
{
type Diff = (A::Diff, B::Diff);
fn diff(self: &(A, B), other: &(A, B)) -> (A::Diff, B::Diff) {
(self.0.diff(&other.0), self.1.diff(&other.1))
}
fn patch(self: &mut (A, B), patch: (A::Diff, B::Diff)) {
self.0.patch(patch.0);
self.1.patch(patch.1);
}
}
/// The possible atomic operations that can be made when modifying a list.
enum EditScript<A, D> {
Add(usize, A),
Remove(usize, A),
Diff(usize, D),
}
impl<A: Diffable> Diffable for Vec<A> {
type Diff = Vec<EditScript<A, A::Diff>>;
fn diff(self: &Vec<A>, other: &Vec<A>) -> Vec<EditScript<A, A::Diff>> {
todo!()