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

impl Command<Resize> {
    pub fn shrink(self) -> Command<Resize<Direction>> {
        self.push_str("shrink").transmute()
    }

    pub fn grow(self) -> Command<Resize<Direction>> {
        self.push_str("grow").transmute()
    }

    //FIXME: sway(5)
    pub fn set(self) -> Command<Resize<With>> {
        self.push_str("set").transmute()
    }
}

impl Command<Resize<With>> {
    pub fn height(self) -> Command<Resize<With<To>>> {
        self.push_str("height").transmute()
    }

    pub fn width(self) -> Command<Resize<With<To>>> {
        self.push_str("width").transmute()
    }
}

impl Command<Resize<With<To>>> {
    pub fn to(self, val: usize) -> Command<Valid<Resize<Direction<With>>>> {
        self.push_str(val.to_string()).transmute()
    }
}

impl Command<Resize<Direction>> {
    pub fn width(self) -> Command<Valid<Resize<Direction>>> {
        self.push_str("width").transmute()
    }

    pub fn height(self) -> Command<Valid> {
        self.push_str("height").transmute()
    }
}

impl Command<Valid<Resize<Direction>>> {
    pub fn amount(self, amount: usize) -> Command<Valid<Resize<Direction<With>>>> {
        self.push_str(amount.to_string()).transmute()
    }
}

impl Command<Valid<Resize<Direction<With>>>> {
    pub fn px(self) -> Command<Valid> {
        self.push_str("px").transmute()
    }

    pub fn ppt(self) -> Command<Valid> {
        self.push_str("ppt").transmute()
    }
}