pub fn parse(data: &[u8]) -> Result<VeryHighThroughputOperation, Error> {
        if data.len() == 5 {
            let width = match data[0] & 0x03 {
                1 => 80,
                2 => 160,
                3 => 80,
                _ => 40,
            };
            let mut max_vht_mcs_ss = [MaxVhtMcs::NotSupported; 8];
            max_vht_mcs_ss[0] = MaxVhtMcs::from((data[3] & 0b0000_0011) >> 0);
            max_vht_mcs_ss[1] = MaxVhtMcs::from((data[3] & 0b0000_1100) >> 2);
            max_vht_mcs_ss[2] = MaxVhtMcs::from((data[3] & 0b0011_0000) >> 4);
            max_vht_mcs_ss[3] = MaxVhtMcs::from((data[3] & 0b1100_0000) >> 6);
            max_vht_mcs_ss[4] = MaxVhtMcs::from((data[4] & 0b0000_0011) >> 0);
            max_vht_mcs_ss[5] = MaxVhtMcs::from((data[4] & 0b0000_1100) >> 2);
            max_vht_mcs_ss[6] = MaxVhtMcs::from((data[4] & 0b0011_0000) >> 4);
            max_vht_mcs_ss[7] = MaxVhtMcs::from((data[4] & 0b1100_0000) >> 6);
            return Ok(VeryHighThroughputOperation {
                width,
                channel: data[1],
                secondary_channel: data[2],
                max_vht_mcs_ss,
            });
        }
        Err(io::Error::new(io::ErrorKind::InvalidData, "Invalid VHT element").into())
    }
/// Parse very high throughput operation from information element payload
Parse very high throughput operation from information element payload
Parse very high throughput operation from information element payload
pub fn parse(data: &[u8]) -> Result<VeryHighThroughputOperation, Error> {
        if data.len() == 5 {
            let width = match data[0] & 0x03 {
                1 => 80,
                2 => 160,
                3 => 80,
                _ => 40,
            };
            let mut max_vht_mcs_ss = [MaxVhtMcs::NotSupported; 8];
            max_vht_mcs_ss[0] = MaxVhtMcs::from((data[3] & 0b0000_0011) >> 0);
            max_vht_mcs_ss[1] = MaxVhtMcs::from((data[3] & 0b0000_1100) >> 2);
            max_vht_mcs_ss[2] = MaxVhtMcs::from((data[3] & 0b0011_0000) >> 4);
            max_vht_mcs_ss[3] = MaxVhtMcs::from((data[3] & 0b1100_0000) >> 6);
            max_vht_mcs_ss[4] = MaxVhtMcs::from((data[4] & 0b0000_0011) >> 0);
            max_vht_mcs_ss[5] = MaxVhtMcs::from((data[4] & 0b0000_1100) >> 2);
            max_vht_mcs_ss[6] = MaxVhtMcs::from((data[4] & 0b0011_0000) >> 4);
            max_vht_mcs_ss[7] = MaxVhtMcs::from((data[4] & 0b1100_0000) >> 6);
            return Ok(VeryHighThroughputOperation {
                width,
                channel: data[1],
                secondary_channel: data[2],
                max_vht_mcs_ss,
            });
        }
        Err(io::Error::new(io::ErrorKind::InvalidData, "Invalid VHT element").into())
    }
pub fn parse ( data : & [ u8 ] ) -> Result < VeryHighThroughputOperation , Error > { if data . len ( ) == 5 { let width = match data [ 0 ] & 0x03 { 1 => 80 , 2 => 160 , 3 => 80 , _ => 40 , } ; let mut max_vht_mcs_ss = [ MaxVhtMcs :: NotSupported ; 8 ] ; max_vht_mcs_ss [ 0 ] = MaxVhtMcs :: from ( ( data [ 3 ] & 0b0000_0011 ) >> 0 ) ; max_vht_mcs_ss [ 1 ] = MaxVhtMcs :: from ( ( data [ 3 ] & 0b0000_1100 ) >> 2 ) ; max_vht_mcs_ss [ 2 ] = MaxVhtMcs :: from ( ( data [ 3 ] & 0b0011_0000 ) >> 4 ) ; max_vht_mcs_ss [ 3 ] = MaxVhtMcs :: from ( ( data [ 3 ] & 0b1100_0000 ) >> 6 ) ; max_vht_mcs_ss [ 4 ] = MaxVhtMcs :: from ( ( data [ 4 ] & 0b0000_0011 ) >> 0 ) ; max_vht_mcs_ss [ 5 ] = MaxVhtMcs :: from ( ( data [ 4 ] & 0b0000_1100 ) >> 2 ) ; max_vht_mcs_ss [ 6 ] = MaxVhtMcs :: from ( ( data [ 4 ] & 0b0011_0000 ) >> 4 ) ; max_vht_mcs_ss [ 7 ] = MaxVhtMcs :: from ( ( data [ 4 ] & 0b1100_0000 ) >> 6 ) ; return Ok ( VeryHighThroughputOperation { width , channel : data [ 1 ] , secondary_channel : data [ 2 ] , max_vht_mcs_ss , } ) ; } Err ( io :: Error :: new ( io :: ErrorKind :: InvalidData , " " ) . into ( ) ) }
Parse very high throughput operation from information element payload
Parse very high throughput operation from information element payload
data
&[u8]
data
&[u8]