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
mod private {
    pub trait Sealed {}

    impl Sealed for super::True {}
    impl Sealed for super::False {}
}

pub trait Boolean: 'static + private::Sealed {
    const VALUE: bool;
}

pub struct False;
impl Boolean for False {
    const VALUE: bool = false;
}

pub struct True;
impl Boolean for True {
    const VALUE: bool = true;
}

pub trait Or<O: Boolean>: Boolean {
    type RESULT: Boolean;
}

impl<O: Boolean> Or<O> for False {
    type RESULT = O;
}

impl<O: Boolean> Or<O> for True {
    type RESULT = True;
}

pub trait And<O: Boolean>: Boolean {
    type RESULT: Boolean;
}

impl<O: Boolean> And<O> for False {
    type RESULT = False;
}

impl<O: Boolean> And<O> for True {
    type RESULT = O;
}