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

impl Command<Assign> {
    pub fn workspace(self) -> Command<Assign<Workspace>> {
        self.push_str("workspace").transmute()
    }

    pub fn output(self) -> Command<Assign<Output>> {
        self.push_str("output").transmute()
    }
}

impl Command<Assign<Workspace>> {
    pub fn name(self, name: impl AsRef<str>) -> Command<Valid> {
        self.push_str(name).transmute()
    }

    pub fn number(self, number: isize) -> Command<Valid> {
        self.push_str("number")
            .push_str(number.to_string())
            .transmute()
    }
}

impl Command<Assign<Output>> {
    pub fn name(self, name: impl AsRef<str>) -> Command<Valid> {
        self.push_str(name).transmute()
    }

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

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

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

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