pub fn from_ids(platform_id: u16, encoding_id: u16) -> Result<Self, ReadError> {
        match platform_id {
            0 => {
                let encoding =
                    UnicodeEncoding::from_id(encoding_id).ok_or(ReadError::UnsupportedEncoding)?;
                Ok(Encoding::Unicode(encoding))
            }
            3 => {
                let encoding =
                    WindowsEncoding::from_id(encoding_id).ok_or(ReadError::UnsupportedEncoding)?;
                Ok(Encoding::Windows(encoding))
            }
            _ => Err(ReadError::UnsupportedPlatform)?,
        }
    }
/// Creates an encoding from a given `platformID` and `encodingID`.
///
/// # Errors
///
/// This function returns an error in case the platform id is unsupported or the encoding id is unsupported.
Creates an encoding from a given `platformID` and `encodingID`.
Creates an encoding from a given ` platformID ` and ` encodingID ` .
pub fn from_ids(platform_id: u16, encoding_id: u16) -> Result<Self, ReadError> {
        match platform_id {
            0 => {
                let encoding =
                    UnicodeEncoding::from_id(encoding_id).ok_or(ReadError::UnsupportedEncoding)?;
                Ok(Encoding::Unicode(encoding))
            }
            3 => {
                let encoding =
                    WindowsEncoding::from_id(encoding_id).ok_or(ReadError::UnsupportedEncoding)?;
                Ok(Encoding::Windows(encoding))
            }
            _ => Err(ReadError::UnsupportedPlatform)?,
        }
    }
pub fn from_ids ( platform_id : u16 , encoding_id : u16 ) -> Result < Self , ReadError > { match platform_id { 0 => { let encoding = UnicodeEncoding :: from_id ( encoding_id ) . ok_or ( ReadError :: UnsupportedEncoding ) ? ; Ok ( Encoding :: Unicode ( encoding ) ) } 3 => { let encoding = WindowsEncoding :: from_id ( encoding_id ) . ok_or ( ReadError :: UnsupportedEncoding ) ? ; Ok ( Encoding :: Windows ( encoding ) ) } _ => Err ( ReadError :: UnsupportedPlatform ) ? , } }
Creates an encoding from a given `platformID` and `encodingID`.
Creates an encoding from a given ` platformID ` and ` encodingID ` .
platform_id
u16
encoding_id
u16
platform_id
u16
encoding_id
u16
errors
This function returns an error in case the platform id is unsupported or the encoding id is unsupported.
This function returns an error in case the platform id is unsupported or the encoding id is unsupported .