use bitflags::bitflags;
bitflags! {
#[repr(transparent)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub struct Flags: u8 {
const UP = 1 << 0;
const UV = 1 << 2;
const BE = 1 << 3;
const BS = 1 << 4;
const AT = 1 << 6;
const ED = 1 << 7;
}
}
impl Default for Flags {
fn default() -> Self {
Flags::BE | Flags::BS
}
}
impl From<Flags> for u8 {
fn from(src: Flags) -> Self {
src.bits()
}
}
impl TryFrom<u8> for Flags {
type Error = ();
fn try_from(value: u8) -> Result<Self, Self::Error> {
Flags::from_bits(value).ok_or(())
}
}