fn encode<W: Write>(&self, w: &mut W) -> Result<(), EncodingError> {
        let mut data = ISO_8859_1
            .encode(&self.keyword, EncoderTrap::Strict)
            .map_err(|_| EncodingError::from(TextEncodingError::Unrepresentable))?;

        if data.is_empty() || data.len() > 79 {
            return Err(TextEncodingError::InvalidKeywordSize.into());
        }

        data.push(0);

        ISO_8859_1
            .encode_to(&self.text, EncoderTrap::Strict, &mut data)
            .map_err(|_| EncodingError::from(TextEncodingError::Unrepresentable))?;

        encoder::write_chunk(w, chunk::tEXt, &data)
    }
/// Encodes TEXtChunk to a Writer. The keyword and text are separated by a byte of zeroes.
Encodes TEXtChunk to a Writer. The keyword and text are separated by a byte of zeroes.
Encodes TEXtChunk to a Writer . The keyword and text are separated by a byte of zeroes .
fn encode<W: Write>(&self, w: &mut W) -> Result<(), EncodingError> {
        let mut data = ISO_8859_1
            .encode(&self.keyword, EncoderTrap::Strict)
            .map_err(|_| EncodingError::from(TextEncodingError::Unrepresentable))?;
        if data.is_empty() || data.len() > 79 {
            return Err(TextEncodingError::InvalidKeywordSize.into());
        }
        data.push(0);
        ISO_8859_1
            .encode_to(&self.text, EncoderTrap::Strict, &mut data)
            .map_err(|_| EncodingError::from(TextEncodingError::Unrepresentable))?;
        encoder::write_chunk(w, chunk::tEXt, &data)
    }
fn encode < W : Write > ( & self , w : & mut W ) -> Result < ( ) , EncodingError > { let mut data = ISO_8859_1 . encode ( & self . keyword , EncoderTrap :: Strict ) . map_err ( | _ | EncodingError :: from ( TextEncodingError :: Unrepresentable ) ) ? ; if data . is_empty ( ) || data . len ( ) > 79 { return Err ( TextEncodingError :: InvalidKeywordSize . into ( ) ) ; } data . push ( 0 ) ; ISO_8859_1 . encode_to ( & self . text , EncoderTrap :: Strict , & mut data ) . map_err ( | _ | EncodingError :: from ( TextEncodingError :: Unrepresentable ) ) ? ; encoder :: write_chunk ( w , chunk :: tEXt , & data ) }
Encodes TEXtChunk to a Writer.
Encodes TEXtChunk to a Writer .
&self
w
&mut W