fn from_handle(handle: AttrHandle<Nl80211Attr>) -> Result<Interface, NlError> {
        let mut interface = Interface {
            ..Default::default()
        };
        for attr in handle.iter() {
            let mut payload = &attr.payload[..];
            match attr.nla_type {
                Nl80211Attr::AttrIfindex => {
                    interface.index = Some(payload.read_u32::<LittleEndian>()?);
                }
                Nl80211Attr::AttrSsid => {
                    interface.ssid = Some(parse_string(&attr.payload));
                }
                Nl80211Attr::AttrMac => {
                    interface.mac = Some(parse_macaddr(&attr.payload)?);
                }
                Nl80211Attr::AttrIfname => {
                    interface.name = Some(parse_string(&attr.payload));
                }
                Nl80211Attr::AttrWiphyFreq => {
                    interface.frequency = Some(payload.read_u32::<LittleEndian>()?)
                }
                Nl80211Attr::AttrChannelWidth => {
                    interface.channel = Some(payload.read_u32::<LittleEndian>()?)
                }
                Nl80211Attr::AttrWiphyTxPowerLevel => {
                    interface.power = Some(payload.read_u32::<LittleEndian>()?)
                }
                Nl80211Attr::AttrWiphy => interface.phy = Some(payload.read_u32::<LittleEndian>()?),
                Nl80211Attr::AttrWdev => {
                    interface.device = Some(payload.read_u64::<LittleEndian>()?)
                }
                _ => (),
            }
        }
        Ok(interface)
    }
/// Parse netlink messages returned by the nl80211 command CmdGetInterface
Parse netlink messages returned by the nl80211 command CmdGetInterface
Parse netlink messages returned by the nl80211 command CmdGetInterface
fn from_handle(handle: AttrHandle<Nl80211Attr>) -> Result<Interface, NlError> {
        let mut interface = Interface {
            ..Default::default()
        };
        for attr in handle.iter() {
            let mut payload = &attr.payload[..];
            match attr.nla_type {
                Nl80211Attr::AttrIfindex => {
                    interface.index = Some(payload.read_u32::<LittleEndian>()?);
                }
                Nl80211Attr::AttrSsid => {
                    interface.ssid = Some(parse_string(&attr.payload));
                }
                Nl80211Attr::AttrMac => {
                    interface.mac = Some(parse_macaddr(&attr.payload)?);
                }
                Nl80211Attr::AttrIfname => {
                    interface.name = Some(parse_string(&attr.payload));
                }
                Nl80211Attr::AttrWiphyFreq => {
                    interface.frequency = Some(payload.read_u32::<LittleEndian>()?)
                }
                Nl80211Attr::AttrChannelWidth => {
                    interface.channel = Some(payload.read_u32::<LittleEndian>()?)
                }
                Nl80211Attr::AttrWiphyTxPowerLevel => {
                    interface.power = Some(payload.read_u32::<LittleEndian>()?)
                }
                Nl80211Attr::AttrWiphy => interface.phy = Some(payload.read_u32::<LittleEndian>()?),
                Nl80211Attr::AttrWdev => {
                    interface.device = Some(payload.read_u64::<LittleEndian>()?)
                }
                _ => (),
            }
        }
        Ok(interface)
    }
fn from_handle ( handle : AttrHandle < Nl80211Attr > ) -> Result < Interface , NlError > { let mut interface = Interface { .. Default :: default ( ) } ; for attr in handle . iter ( ) { let mut payload = & attr . payload [ .. ] ; match attr . nla_type { Nl80211Attr :: AttrIfindex => { interface . index = Some ( payload . read_u32 :: < LittleEndian > ( ) ? ) ; } Nl80211Attr :: AttrSsid => { interface . ssid = Some ( parse_string ( & attr . payload ) ) ; } Nl80211Attr :: AttrMac => { interface . mac = Some ( parse_macaddr ( & attr . payload ) ? ) ; } Nl80211Attr :: AttrIfname => { interface . name = Some ( parse_string ( & attr . payload ) ) ; } Nl80211Attr :: AttrWiphyFreq => { interface . frequency = Some ( payload . read_u32 :: < LittleEndian > ( ) ? ) } Nl80211Attr :: AttrChannelWidth => { interface . channel = Some ( payload . read_u32 :: < LittleEndian > ( ) ? ) } Nl80211Attr :: AttrWiphyTxPowerLevel => { interface . power = Some ( payload . read_u32 :: < LittleEndian > ( ) ? ) } Nl80211Attr :: AttrWiphy => interface . phy = Some ( payload . read_u32 :: < LittleEndian > ( ) ? ) , Nl80211Attr :: AttrWdev => { interface . device = Some ( payload . read_u64 :: < LittleEndian > ( ) ? ) } _ => ( ) , } } Ok ( interface ) }
Parse netlink messages returned by the nl80211 command CmdGetInterface
Parse netlink messages returned by the nl80211 command CmdGetInterface
handle
AttrHandle<Nl80211Attr>
handle
AttrHandle<Nl80211Attr>