just/src/verbosity.rs

46 lines
818 B
Rust
Raw Normal View History

use Verbosity::*;
#[derive(Copy, Clone, Debug, PartialEq)]
pub(crate) enum Verbosity {
Quiet,
Taciturn,
Loquacious,
Grandiloquent,
}
impl Verbosity {
2024-05-14 20:29:40 -07:00
pub(crate) fn from_flag_occurrences(flag_occurrences: u8) -> Self {
2022-05-28 19:07:53 -07:00
match flag_occurrences {
0 => Taciturn,
1 => Loquacious,
_ => Grandiloquent,
}
}
pub(crate) fn quiet(self) -> bool {
2020-10-09 15:44:17 -07:00
matches!(self, Quiet)
}
pub(crate) fn loud(self) -> bool {
!self.quiet()
}
pub(crate) fn loquacious(self) -> bool {
match self {
Quiet | Taciturn => false,
Loquacious | Grandiloquent => true,
}
}
pub(crate) fn grandiloquent(self) -> bool {
match self {
Quiet | Taciturn | Loquacious => false,
Grandiloquent => true,
}
}
2022-12-15 16:53:21 -08:00
pub const fn default() -> Self {
2023-10-16 20:07:09 -07:00
Taciturn
}
}