Skip to main content

alint_core/
level.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4#[serde(rename_all = "lowercase")]
5pub enum Level {
6    Error,
7    Warning,
8    Info,
9    Off,
10}
11
12impl Level {
13    pub fn is_actionable(self) -> bool {
14        matches!(self, Self::Error | Self::Warning | Self::Info)
15    }
16
17    pub fn as_str(self) -> &'static str {
18        match self {
19            Self::Error => "error",
20            Self::Warning => "warning",
21            Self::Info => "info",
22            Self::Off => "off",
23        }
24    }
25}