pub fn parse(data: &[u8]) -> Result<Ssid, Error> {
        // First try to decode utf8
        let ssid = String::from_utf8(data.to_vec()).unwrap_or_else(|_|
            // Then try ISO 8859-1
            ISO_8859_1.decode(data, DecoderTrap::Strict)
                .unwrap_or_default());
        let ssid = ssid.trim_end_matches('\0').to_string();
        Ok(Ssid { ssid })
    }
/// Parse information payload as SSID
///
/// This function will try to decode the string as UTF-8 first, if UTF-8 decoding fails
/// try to decode using ISO-8859-1 dedoding, if all fails return an emty string,
///
Parse information payload as SSID
This function will try to decode the string as UTF-8 first, if UTF-8 decoding fails
try to decode using ISO-8859-1 dedoding, if all fails return an emty string.
Parse information payload as SSID This function will try to decode the string as UTF - 8 first if UTF - 8 decoding fails try to decode using ISO - 8859 - 1 dedoding if all fails return an emty string .
pub fn parse(data: &[u8]) -> Result<Ssid, Error> {
        // First try to decode utf8
        let ssid = String::from_utf8(data.to_vec()).unwrap_or_else(|_|
            // Then try ISO 8859-1
            ISO_8859_1.decode(data, DecoderTrap::Strict)
                .unwrap_or_default());
        let ssid = ssid.trim_end_matches('\0').to_string();
        Ok(Ssid { ssid })
    }
pub fn parse ( data : & [ u8 ] ) -> Result < Ssid , Error > { // First try to decode utf8 let ssid = String :: from_utf8 ( data . to_vec ( ) ) . unwrap_or_else ( | _ | // Then try ISO 8859-1 ISO_8859_1 . decode ( data , DecoderTrap :: Strict ) . unwrap_or_default ( ) ) ; let ssid = ssid . trim_end_matches ( '\0' ) . to_string ( ) ; Ok ( Ssid { ssid } ) }
Parse information payload as SSID
This function will try to decode the string as UTF-8 first, if UTF-8 decoding fails
try to decode using ISO-8859-1 dedoding, if all fails return an emty string,
Parse information payload as SSID This function will try to decode the string as UTF - 8 first if UTF - 8 decoding fails try to decode using ISO - 8859 - 1 dedoding if all fails return an emty string
data
&[u8]
data
&[u8]