pub fn from(id: InformationElementId, data: &'a [u8]) -> Result<InformationElement<'a>, Error> {
        let ie = match id {
            InformationElementId::Ssid => {
                let ie = Ssid::parse(data)?;
                InformationElement::Ssid(ie)
            }
            InformationElementId::Country => {
                let ie = Country::parse(data)?;
                InformationElement::Country(ie)
            }
            InformationElementId::ChannelSwitchAnnouncement => {
                let ie = ChannelSwitchAnnouncement::parse(data)?;
                InformationElement::ChannelSwitchAnnouncement(ie)
            }
            InformationElementId::RobustSecurityNetwork => {
                let ie = RobustSecurityNetwork::parse(data)?;
                InformationElement::RobustSecurityNetwork(ie)
            }
            InformationElementId::ExtendedChannelSwitchAnnouncement => {
                let ie = ExtendedChannelSwitchAnnouncement::parse(data)?;
                InformationElement::ExtendedChannelSwitchAnnouncement(ie)
            }
            InformationElementId::HighThroughputOperation => {
                let ie = HighThroughputOperation::parse(data)?;
                InformationElement::HighThroughputOperation(ie)
            }
            InformationElementId::VeryHighThroughputOperation => {
                let ie = VeryHighThroughputOperation::parse(data)?;
                InformationElement::VeryHighThroughputOperation(ie)
            }
            _ => InformationElement::Other(RawInformationElement {
                identifier: id.into(),
                data,
            }),
        };
        Ok(ie)
    }
///  Parse identifier and payload into information element
Parse identifier and payload into information element
Parse identifier and payload into information element
pub fn from(id: InformationElementId, data: &'a [u8]) -> Result<InformationElement<'a>, Error> {
        let ie = match id {
            InformationElementId::Ssid => {
                let ie = Ssid::parse(data)?;
                InformationElement::Ssid(ie)
            }
            InformationElementId::Country => {
                let ie = Country::parse(data)?;
                InformationElement::Country(ie)
            }
            InformationElementId::ChannelSwitchAnnouncement => {
                let ie = ChannelSwitchAnnouncement::parse(data)?;
                InformationElement::ChannelSwitchAnnouncement(ie)
            }
            InformationElementId::RobustSecurityNetwork => {
                let ie = RobustSecurityNetwork::parse(data)?;
                InformationElement::RobustSecurityNetwork(ie)
            }
            InformationElementId::ExtendedChannelSwitchAnnouncement => {
                let ie = ExtendedChannelSwitchAnnouncement::parse(data)?;
                InformationElement::ExtendedChannelSwitchAnnouncement(ie)
            }
            InformationElementId::HighThroughputOperation => {
                let ie = HighThroughputOperation::parse(data)?;
                InformationElement::HighThroughputOperation(ie)
            }
            InformationElementId::VeryHighThroughputOperation => {
                let ie = VeryHighThroughputOperation::parse(data)?;
                InformationElement::VeryHighThroughputOperation(ie)
            }
            _ => InformationElement::Other(RawInformationElement {
                identifier: id.into(),
                data,
            }),
        };
        Ok(ie)
    }
pub fn from ( id : InformationElementId , data : & ' a [ u8 ] ) -> Result < InformationElement < ' a > , Error > { let ie = match id { InformationElementId :: Ssid => { let ie = Ssid :: parse ( data ) ? ; InformationElement :: Ssid ( ie ) } InformationElementId :: Country => { let ie = Country :: parse ( data ) ? ; InformationElement :: Country ( ie ) } InformationElementId :: ChannelSwitchAnnouncement => { let ie = ChannelSwitchAnnouncement :: parse ( data ) ? ; InformationElement :: ChannelSwitchAnnouncement ( ie ) } InformationElementId :: RobustSecurityNetwork => { let ie = RobustSecurityNetwork :: parse ( data ) ? ; InformationElement :: RobustSecurityNetwork ( ie ) } InformationElementId :: ExtendedChannelSwitchAnnouncement => { let ie = ExtendedChannelSwitchAnnouncement :: parse ( data ) ? ; InformationElement :: ExtendedChannelSwitchAnnouncement ( ie ) } InformationElementId :: HighThroughputOperation => { let ie = HighThroughputOperation :: parse ( data ) ? ; InformationElement :: HighThroughputOperation ( ie ) } InformationElementId :: VeryHighThroughputOperation => { let ie = VeryHighThroughputOperation :: parse ( data ) ? ; InformationElement :: VeryHighThroughputOperation ( ie ) } _ => InformationElement :: Other ( RawInformationElement { identifier : id . into ( ) , data , } ) , } ; Ok ( ie ) }
Parse identifier and payload into information element
Parse identifier and payload into information element
id
InformationElementId
data
&'a [u8]
id
InformationElementId
data
&'a [u8]