Nothing to see here, move along
at main 44 lines 975 B view raw
1#[derive(Debug, Clone, Copy, PartialEq, Eq)] 2pub enum PhaseStatus { 3 Pending, 4 Active, 5 Done, 6 Failed, 7} 8 9#[derive(Debug, Clone, Copy)] 10pub struct Phase { 11 pub name: &'static str, 12 pub status: PhaseStatus, 13 pub row_budget: u8, 14} 15 16impl Phase { 17 pub const fn new(name: &'static str, row_budget: u8) -> Self { 18 Self { 19 name, 20 status: PhaseStatus::Pending, 21 row_budget, 22 } 23 } 24 25 pub const fn with_status(self, status: PhaseStatus) -> Self { 26 Self { status, ..self } 27 } 28 29 pub const fn is_active(self) -> bool { 30 matches!(self.status, PhaseStatus::Active) 31 } 32 33 pub const fn is_done(self) -> bool { 34 matches!(self.status, PhaseStatus::Done) 35 } 36 37 pub const fn is_failed(self) -> bool { 38 matches!(self.status, PhaseStatus::Failed) 39 } 40 41 pub const fn is_terminal(self) -> bool { 42 matches!(self.status, PhaseStatus::Done | PhaseStatus::Failed) 43 } 44}