pub fn parse(data: &[u8]) -> Result<Country, Error> {
        if data.len() >= 6 {
            let alpha2 = String::from_utf8(data[..2].to_vec()).unwrap();
            return Ok(Country { alpha2 });
        }
        println!("Bad country element {}", data.len());
        Err(io::Error::new(io::ErrorKind::InvalidData, "Invalid Country element").into())
    }
/// Parse country from information element payload
Parse country from information element payload
Parse country from information element payload
pub fn parse(data: &[u8]) -> Result<Country, Error> {
        if data.len() >= 6 {
            let alpha2 = String::from_utf8(data[..2].to_vec()).unwrap();
            return Ok(Country { alpha2 });
        }
        println!("Bad country element {}", data.len());
        Err(io::Error::new(io::ErrorKind::InvalidData, "Invalid Country element").into())
    }
pub fn parse ( data : & [ u8 ] ) -> Result < Country , Error > { if data . len ( ) >= 6 { let alpha2 = String :: from_utf8 ( data [ .. 2 ] . to_vec ( ) ) . unwrap ( ) ; return Ok ( Country { alpha2 } ) ; } println ! ( " " data len ( ) ) ; Err ( io :: Error :: new ( io :: ErrorKind :: InvalidData , " " ) . into ( ) ) }
Parse country from information element payload
Parse country from information element payload
data
&[u8]
data
&[u8]