#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Stage { Resolve, Install, FinalizeRootfs, BuildInitramfs, Package, Manifest, } impl Stage { pub const ORDERED: [Self; 6] = [ Self::Resolve, Self::Install, Self::FinalizeRootfs, Self::BuildInitramfs, Self::Package, Self::Manifest, ]; pub fn dependencies(self) -> &'static [Self] { match self { Self::Resolve => &[], Self::Install => &[Self::Resolve], Self::FinalizeRootfs => &[Self::Install], Self::BuildInitramfs => &[Self::Install], Self::Package => &[Self::FinalizeRootfs, Self::BuildInitramfs], Self::Manifest => &[Self::Package], } } } impl std::fmt::Display for Stage { fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let name = match self { Self::Resolve => "resolve", Self::Install => "install", Self::FinalizeRootfs => "finalize-rootfs", Self::BuildInitramfs => "initramfs", Self::Package => "package", Self::Manifest => "manifest", }; formatter.write_str(name) } }