pub(crate) fn decode(
        keyword_slice: &[u8],
        text_slice: &[u8],
    ) -> Result<Self, TextDecodingError> {
        if keyword_slice.is_empty() || keyword_slice.len() > 79 {
            return Err(TextDecodingError::InvalidKeywordSize);
        }

        Ok(Self {
            keyword: ISO_8859_1
                .decode(keyword_slice, DecoderTrap::Strict)
                .map_err(|_| TextDecodingError::Unrepresentable)?,
            text: ISO_8859_1
                .decode(text_slice, DecoderTrap::Strict)
                .map_err(|_| TextDecodingError::Unrepresentable)?,
        })
    }
/// Decodes a slice of bytes to a String using Latin-1 decoding.
/// The decoder runs in strict mode, and any decoding errors are passed along to the caller.
Decodes a slice of bytes to a String using Latin-1 decoding.
The decoder runs in strict mode, and any decoding errors are passed along to the caller.
Decodes a slice of bytes to a String using Latin - 1 decoding . The decoder runs in strict mode and any decoding errors are passed along to the caller .
pub(crate) fn decode(
        keyword_slice: &[u8],
        text_slice: &[u8],
    ) -> Result<Self, TextDecodingError> {
        if keyword_slice.is_empty() || keyword_slice.len() > 79 {
            return Err(TextDecodingError::InvalidKeywordSize);
        }
        Ok(Self {
            keyword: ISO_8859_1
                .decode(keyword_slice, DecoderTrap::Strict)
                .map_err(|_| TextDecodingError::Unrepresentable)?,
            text: ISO_8859_1
                .decode(text_slice, DecoderTrap::Strict)
                .map_err(|_| TextDecodingError::Unrepresentable)?,
        })
    }
pub ( crate ) fn decode ( keyword_slice : & [ u8 ] , text_slice : & [ u8 ] , ) -> Result < Self , TextDecodingError > { if keyword_slice . is_empty ( ) || keyword_slice . len ( ) > 79 { return Err ( TextDecodingError :: InvalidKeywordSize ) ; } Ok ( Self { keyword : ISO_8859_1 . decode ( keyword_slice , DecoderTrap :: Strict ) . map_err ( | _ | TextDecodingError :: Unrepresentable ) ? , text : ISO_8859_1 . decode ( text_slice , DecoderTrap :: Strict ) . map_err ( | _ | TextDecodingError :: Unrepresentable ) ? , } ) }
Decodes a slice of bytes to a String using Latin-1 decoding.
Decodes a slice of bytes to a String using Latin - 1 decoding .
keyword_slice
&[u8]
text_slice
&[u8]