abler/
kind.rs

1use strum::{VariantArray, IntoStaticStr};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, VariantArray, IntoStaticStr)]
4pub enum Kind {
5    #[default]
6    Able,
7    Bool,
8    Switch,
9    Spoken,
10}
11
12impl Kind {
13    const ABLE: &'static [&'static str; 2] = &["disable", "enable"];
14    const BOOL: &'static [&'static str; 2] = &["false", "true"];
15    const SWITCH: &'static [&'static str; 2] = &["off", "on"];
16    const SPOKEN: &'static [&'static str; 2] = &["no", "yes"];
17
18    pub fn names(self) -> &'static [&'static str; 2] {
19        match self {
20            Self::Able => &Self::ABLE,
21            Self::Bool => &Self::BOOL,
22            Self::Switch => &Self::SWITCH,
23            Self::Spoken => &Self::SPOKEN,
24        }
25    }
26}
27
28impl core::fmt::Display for Kind {
29    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
30        f.write_str((*self).into())
31    }
32}