| 1 | /// Represents a type which can be diffed. |
| 2 | /// |
| 3 | /// For more information, see the [crate-level documentation](crate). |
| 4 | pub trait Diffable { |
| 5 | /// The type of the diff. |
| 6 | /// |
| 7 | /// This is a [generic associated type][GAT], also known as a GAT. The |
| 8 | /// `'daft` lifetime is used in the `diff` method to ensure that the |
| 9 | /// returned diff is valid for the lifetime of the input values. |
| 10 | /// |
| 11 | /// [GAT]: https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html |
| 12 | type Diff<'daft> |
| 13 | where |
| 14 | Self: 'daft; |
| 15 | |
| 16 | /// Compute the diff between two values. |
| 17 | fn diff<'daft>(&'daft self, other: &'daft Self) -> Self::Diff<'daft>; |
| 18 | } |