1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#![feature(specialization)]
pub use impl_inheritance_macros::*;
pub type Placeholder = std::convert::Infallible;
pub trait SuperBorrow<T>
where T: ? Sized
{
fn super_ref(&self) -> & T;
fn super_ref_mut(& mut self) -> & mut T;
}
pub trait IsSuperBorrowableTo<T>
where T : ?Sized {
fn get_part(x : &T) -> &Self;
fn get_part_mut(x :& mut T) -> & mut Self;
}
impl <T,X> IsSuperBorrowableTo<T> for X
where T : SuperBorrow<X> {
fn get_part(x : &T) -> &X {
x.super_ref()
}
fn get_part_mut(x :& mut T) -> & mut X
{
x.super_ref_mut()
}
}
pub trait SuperType {
type SupType;
}
impl SuperType for Placeholder {
type SupType = Placeholder;
}
expand_constraits_def!();