1
2
3
4
5
6
7
8
9
10
11
12
pub trait Apply<D> {
    fn apply(&mut self, diff: D);
}

impl<T> Apply<T> for T
where
    T: Clone,
{
    fn apply(&mut self, diff: T) {
        *self = diff;
    }
}