arachnid_cli/config/types/
mode.rs

1/*
2    Appellation: mode <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5
6/// [Mode] enumerates the possible runtime modes of the application.
7#[derive(
8    Clone,
9    Copy,
10    Debug,
11    Default,
12    Eq,
13    Hash,
14    Ord,
15    PartialEq,
16    PartialOrd,
17    clap::ValueEnum,
18    serde::Deserialize,
19    serde::Serialize,
20    strum::AsRefStr,
21    strum::Display,
22    strum::EnumCount,
23    strum::EnumIs,
24    strum::EnumIter,
25    strum::VariantArray,
26    strum::VariantNames,
27)]
28#[serde(rename_all = "lowercase")]
29#[strum(serialize_all = "lowercase")]
30pub enum Mode {
31    #[default]
32    #[clap(name = "debug")]
33    #[serde(alias = "d", alias = "dev", alias = "development")]
34    Debug,
35    #[clap(name = "release")]
36    #[serde(alias = "r", alias = "prod", alias = "production")]
37    Release,
38}
39
40impl Mode {
41    /// a functional constructor for the [`Debug`](Mode::Debug) variant
42    pub const fn debug() -> Self {
43        Self::Debug
44    }
45    /// a functional constructor for the [`Release`](Mode::Release) variant
46    pub const fn release() -> Self {
47        Self::Release
48    }
49}