use std::fmt::Display;
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub enum BandWidth {
#[default]
HT20,
HT40,
MHz80,
MHz160,
}
impl Display for BandWidth {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.cmd())
}
}
impl BandWidth {
pub fn cmd(&self) -> &'static str {
match self {
BandWidth::HT20 => "HT20",
BandWidth::HT40 => "HT40",
BandWidth::MHz80 => "80MHz",
BandWidth::MHz160 => "160MHz",
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SecondChannel {
Below,
Above,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) enum BandWidthArg {
HT20,
HT40Above,
HT40Below,
MHz80,
MHz160,
}
impl Display for BandWidthArg {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match self {
BandWidthArg::HT20 => "HT20",
BandWidthArg::HT40Above => "HT40+",
BandWidthArg::HT40Below => "HT40-",
BandWidthArg::MHz80 => "80MHz",
BandWidthArg::MHz160 => "160MHz",
}
)
}
}