1use std::fmt::Display;
2
3#[repr(C)]
4#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub enum BandWidth {
6 HT20,
7 HT40,
8 MHz80,
9 MHz160,
10}
11
12impl Default for BandWidth {
13 fn default() -> Self {
14 Self::HT20
15 }
16}
17
18impl Display for BandWidth {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 write!(f, "{}", self.cmd())
21 }
22}
23
24impl BandWidth {
25 pub fn cmd(&self) -> &'static str {
26 match self {
27 BandWidth::HT20 => "HT20",
28 BandWidth::HT40 => "HT40",
29 BandWidth::MHz80 => "80MHz",
30 BandWidth::MHz160 => "160MHz",
31 }
32 }
33}
34
35#[repr(C)]
36#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
37pub enum SecondChannel {
38 Below,
39 Above,
40}
41
42#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
43pub(crate) enum BandWidthArg {
44 HT20,
45 HT40Above,
46 HT40Below,
47 MHz80,
48 MHz160,
49}
50
51impl Display for BandWidthArg {
52 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53 write!(
54 f,
55 "{}",
56 match self {
57 BandWidthArg::HT20 => "HT20",
58 BandWidthArg::HT40Above => "HT40+",
59 BandWidthArg::HT40Below => "HT40-",
60 BandWidthArg::MHz80 => "80MHz",
61 BandWidthArg::MHz160 => "160MHz",
62 }
63 )
64 }
65}