#[derive(Debug, Copy, Clone, PartialEq)] pub enum ShieldType { Barrier, Shield, } impl ShieldType { pub fn value(&self) -> [u8; 3] { match self { ShieldType::Barrier => [0x01, 0x02, 0x00], ShieldType::Shield => [0x01, 0x02, 0x01], } } } // TODO: TryFrom<&str> // TODO Into #[derive(Debug, Copy, Clone, PartialEq)] pub struct Shield { pub shield: ShieldType, pub dfp: u8, pub evp: u8, } impl Shield { pub fn as_bytes(&self) -> [u8; 16] { let mut result = [0; 16]; result[0..3].copy_from_slice(&self.shield.value()); // TODO: other attrs result } }