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

#[derive(Default)]
pub struct Macb {
    pub modified: bool,
    pub accessed: bool,
    pub changed: bool,
    pub created: bool,
}

impl From<&Macb> for String {
    fn from(me: &Macb) -> Self {
        let mut macb = ['.', '.', '.', '.'];
        if me.modified { macb[0] = 'm'; }
        if me.accessed { macb[1] = 'a'; }
        if me.changed { macb[2] = 'c'; }
        if me.created { macb[3] = 'b'; }

        macb.into_iter().collect()
    }
}

impl From<&Macb> for Vec<&str> {
    fn from(me: &Macb) -> Self {
        let mut res = Vec::new();
        if me.modified { res.push("modified"); }
        if me.accessed { res.push("accessed"); }
        if me.changed { res.push("changed"); }
        if me.created { res.push("created"); }
        res
    }
}