#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Mode {
#[default]
Simple,
Advanced,
}
impl Mode {
pub const ALL: [Self; 2] = [Self::Simple, Self::Advanced];
pub(crate) const fn word(self) -> &'static str {
match self {
Self::Simple => "simple",
Self::Advanced => "advanced",
}
}
pub(crate) const fn says(self) -> &'static str {
match self {
Self::Simple => "for talking; the bar and the chat",
Self::Advanced => "rails beside the chat — the branch and the context",
}
}
#[must_use]
pub const fn other(self) -> Self {
match self {
Self::Simple => Self::Advanced,
Self::Advanced => Self::Simple,
}
}
pub fn of(word: &str) -> Option<Self> {
Self::ALL.into_iter().find(|mode| mode.word() == word)
}
pub const CHOICE: &'static [(&'static str, &'static str)] = &[
(Self::Simple.word(), Self::Simple.says()),
(Self::Advanced.word(), Self::Advanced.says()),
];
}