pub_just/
verbosity.rs

1#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
2pub enum Verbosity {
3  Quiet,
4  Taciturn,
5  Loquacious,
6  Grandiloquent,
7}
8
9impl Verbosity {
10  pub fn from_flag_occurrences(flag_occurrences: u8) -> Self {
11    match flag_occurrences {
12      0 => Self::Taciturn,
13      1 => Self::Loquacious,
14      _ => Self::Grandiloquent,
15    }
16  }
17
18  pub fn quiet(self) -> bool {
19    self == Self::Quiet
20  }
21
22  pub fn loud(self) -> bool {
23    !self.quiet()
24  }
25
26  pub fn loquacious(self) -> bool {
27    self >= Self::Loquacious
28  }
29
30  pub fn grandiloquent(self) -> bool {
31    self >= Self::Grandiloquent
32  }
33
34  pub const fn default() -> Self {
35    Self::Taciturn
36  }
37}
38
39impl Default for Verbosity {
40  fn default() -> Self {
41    Self::default()
42  }
43}