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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
pub trait Padding: Clone + Copy {
fn len() -> usize;
}
#[derive(Clone, Debug, Copy)]
pub struct P1 {}
#[derive(Clone, Debug, Copy)]
pub struct P2 {}
#[derive(Clone, Debug, Copy)]
pub struct P3 {}
pub trait LessEq<P: Padding>: Padding {}
impl LessEq<P1> for P1 {}
impl LessEq<P2> for P1 {}
impl LessEq<P2> for P2 {}
impl LessEq<P3> for P1 {}
impl LessEq<P3> for P2 {}
impl LessEq<P3> for P3 {}
pub trait GreaterEq<P: Padding>: Padding {}
impl GreaterEq<P1> for P1 {}
impl GreaterEq<P1> for P2 {}
impl GreaterEq<P1> for P3 {}
impl GreaterEq<P2> for P2 {}
impl GreaterEq<P2> for P3 {}
impl GreaterEq<P3> for P3 {}
pub trait EqualTo<P: Padding>: Padding {}
impl<Pa: LessEq<Pb> + GreaterEq<Pb>, Pb: Padding> EqualTo<Pb> for Pa {}
impl Padding for P1 {
fn len() -> usize {
1
}
}
impl Padding for P2 {
fn len() -> usize {
2
}
}
impl Padding for P3 {
fn len() -> usize {
3
}
}