Skip to main content

mocra_core/utils/
priority.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(
4    Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Default,
5)]
6pub enum Priority {
7    #[serde(rename = "low")]
8    Low = 1,
9    #[default]
10    #[serde(rename = "normal")]
11    Normal = 5,
12    #[serde(rename = "high")]
13    High = 10,
14}
15
16impl Priority {
17    pub fn suffix(&self) -> &'static str {
18        match self {
19            Priority::Low => "low",
20            Priority::Normal => "normal",
21            Priority::High => "high",
22        }
23    }
24}
25
26pub trait Prioritizable {
27    fn get_priority(&self) -> Priority;
28}