SHARE
TWEET

Untitled




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> 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));
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.