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
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Profile(pub &'static str);

impl Profile {
    pub const DEV: Self = Self("dev");
    pub const TEST: Self = Self("test");
    pub const BENCH: Self = Self("bench");
    pub const RELEASE: Self = Self("release");

    pub(crate) fn target_dir_name(self) -> &'static str {
        match self {
            Self::DEV => "debug",
            Self(s) => s,
        }
    }
}

impl From<&'static str> for Profile {
    fn from(s: &'static str) -> Self {
        Self(s)
    }
}

impl PartialEq<str> for Profile {
    fn eq(&self, other: &str) -> bool {
        self.0 == other
    }
}