#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PhaseStatus { Pending, Active, Done, Failed, } #[derive(Debug, Clone, Copy)] pub struct Phase { pub name: &'static str, pub status: PhaseStatus, pub row_budget: u8, } impl Phase { pub const fn new(name: &'static str, row_budget: u8) -> Self { Self { name, status: PhaseStatus::Pending, row_budget, } } pub const fn with_status(self, status: PhaseStatus) -> Self { Self { status, ..self } } pub const fn is_active(self) -> bool { matches!(self.status, PhaseStatus::Active) } pub const fn is_done(self) -> bool { matches!(self.status, PhaseStatus::Done) } pub const fn is_failed(self) -> bool { matches!(self.status, PhaseStatus::Failed) } pub const fn is_terminal(self) -> bool { matches!(self.status, PhaseStatus::Done | PhaseStatus::Failed) } }