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
use rui::*;

#[derive(Clone, Copy)]
enum MyControlType {
    Chill,
    Agro,
}

impl Default for MyControlType {
    fn default() -> Self {
        Self::Chill
    }
}

trait MyMods: View + Sized {
    fn agro(self) -> Self;
}

fn my_control() -> impl MyMods {
    modview(|t, _| {
        circle().color(match t {
            MyControlType::Chill => AZURE_HIGHLIGHT,
            MyControlType::Agro => RED_HIGHLIGHT,
        })
    })
}

impl<F> MyMods for ModView<MyControlType, F>
where
    ModView<MyControlType, F>: View,
{
    fn agro(self) -> Self {
        ModView {
            func: self.func,
            value: MyControlType::Agro,
        }
    }
}

fn main() {
    rui(vstack((
        my_control().padding(Auto),
        my_control().agro().padding(Auto),
    )))
}