1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
pub mod collection;
pub mod map;
pub mod option;
pub mod primitives;
pub mod set;
pub mod string;

use crate::{edit, Diffable};

impl<'a, T: Diffable<'a> + 'a> Diffable<'a> for &'a T {
    type Diff = T::Diff;

    fn diff(&'a self, other: &'a Self) -> edit::Edit<'a, Self> {
        match (*self).diff(*other) {
            edit::Edit::Change(diff) => edit::Edit::Change(diff),
            edit::Edit::Copy(_) => edit::Edit::Copy(self),
        }
    }
}