pub fn parse(data: &'a [u8]) -> Result<RawInformationElement<'a>, Error> {
        if data.len() < 2 {
            return Err(io::Error::new(io::ErrorKind::InvalidData, "").into());
        }
        let identifier = u8::unpack_unchecked(data);
        let length = u8::unpack_unchecked(&data[1..]);
        let length = length as usize;
        if data.len() < length {
            return Err(io::Error::new(io::ErrorKind::InvalidData, "").into());
        }
        Ok(RawInformationElement {
            identifier,
            data: &data[2..(length + 2)],
        })
    }
/// Parse information element from byte slice
Parse information element from byte slice
Parse information element from byte slice
pub fn parse(data: &'a [u8]) -> Result<RawInformationElement<'a>, Error> {
        if data.len() < 2 {
            return Err(io::Error::new(io::ErrorKind::InvalidData, "").into());
        }
        let identifier = u8::unpack_unchecked(data);
        let length = u8::unpack_unchecked(&data[1..]);
        let length = length as usize;
        if data.len() < length {
            return Err(io::Error::new(io::ErrorKind::InvalidData, "").into());
        }
        Ok(RawInformationElement {
            identifier,
            data: &data[2..(length + 2)],
        })
    }
pub fn parse ( data : & ' a [ u8 ] ) -> Result < RawInformationElement < ' a > , Error > { if data . len ( ) < 2 { return Err ( io :: Error :: new ( io :: ErrorKind :: InvalidData , " " ) . into ( ) ) ; } let identifier = u8 :: unpack_unchecked ( data ) ; let length = u8 :: unpack_unchecked ( & data [ 1 .. ] ) ; let length = length as usize ; if data . len ( ) < length { return Err ( io :: Error :: new ( io :: ErrorKind :: InvalidData , " " ) . into ( ) ) ; } Ok ( RawInformationElement { identifier , data : & data [ 2 .. ( length + 2 ) ] , } ) }
Parse information element from byte slice
Parse information element from byte slice
data
&'a [u8]
data
&'a [u8]