use bitflags::bitflags;
use le_stream::{FromLeStream, ToLeStream};
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, FromLeStream, ToLeStream)]
#[repr(transparent)]
pub struct Control(u8);
bitflags! {
impl Control: u8 {
const FRAGMENTATION = 0b1100_0000;
const RESERVED = 0b0011_1111;
const FIRST_FRAGMENT = 0b0100_0000;
const FOLLOWUP_FRAGMENT = 0b1000_0000;
}
}
impl core::fmt::Display for Control {
fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
bitflags::parser::to_writer(self, formatter)
}
}
impl core::str::FromStr for Control {
type Err = bitflags::parser::ParseError;
fn from_str(flags: &str) -> Result<Self, Self::Err> {
bitflags::parser::from_str(flags)
}
}