You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
674 B

#[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<String>
#[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
}
}