Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(dead_code)]
- #![allow(unused_variables)]
- #![allow(unused_imports)]
- trait Diff<'da> {
- type Target: 'da;
- fn diff(&'da self, other: &'da Self) -> Edit<'da, Self::Target>;
- }
- enum Edit<'da, T> {
- Copy,
- Change(&'da T),
- }
- struct A<'a>(&'a u32);
- struct EditedA<'da, 'a>(Edit<'da, A<'a>>);
- impl<'da, 'a: 'da> Diff<'da> for A<'a> {
- type Target = &'a u32;
- fn diff(&'da self, other: &'da Self) -> Edit<'da, Self::Target> {
- Edit::Change(&other.0)
- }
- }
- fn main() {
- A(&32).diff(&A(&22));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement