pub fn decompress_text_with_limit(&mut self, limit: usize) -> Result<(), DecodingError> {
        match &self.text {
            OptCompressed::Compressed(v) => {
                let uncompressed_raw = match decompress_to_vec_zlib_with_limit(&v[..], limit) {
                    Ok(s) => s,
                    Err(miniz_oxide::inflate::TINFLStatus::HasMoreOutput) => {
                        return Err(DecodingError::from(
                            TextDecodingError::OutOfDecompressionSpace,
                        ));
                    }
                    Err(_) => {
                        return Err(DecodingError::from(TextDecodingError::InflationError));
                    }
                };
                self.text = OptCompressed::Uncompressed(
                    String::from_utf8(uncompressed_raw)
                        .map_err(|_| TextDecodingError::Unrepresentable)?,
                );
            }
            OptCompressed::Uncompressed(_) => {}
        };
        Ok(())
    }
/// Decompresses the inner text, mutating its own state. Can only handle decompressed text up to `limit` bytes.
Decompresses the inner text, mutating its own state. Can only handle decompressed text up to `limit` bytes.
Decompresses the inner text mutating its own state . Can only handle decompressed text up to ` limit ` bytes .
pub fn decompress_text_with_limit(&mut self, limit: usize) -> Result<(), DecodingError> {
        match &self.text {
            OptCompressed::Compressed(v) => {
                let uncompressed_raw = match decompress_to_vec_zlib_with_limit(&v[..], limit) {
                    Ok(s) => s,
                    Err(miniz_oxide::inflate::TINFLStatus::HasMoreOutput) => {
                        return Err(DecodingError::from(
                            TextDecodingError::OutOfDecompressionSpace,
                        ));
                    }
                    Err(_) => {
                        return Err(DecodingError::from(TextDecodingError::InflationError));
                    }
                };
                self.text = OptCompressed::Uncompressed(
                    String::from_utf8(uncompressed_raw)
                        .map_err(|_| TextDecodingError::Unrepresentable)?,
                );
            }
            OptCompressed::Uncompressed(_) => {}
        };
        Ok(())
    }
pub fn decompress_text_with_limit ( & mut self , limit : usize ) -> Result < ( ) , DecodingError > { match & self . text { OptCompressed :: Compressed ( v ) => { let uncompressed_raw = match decompress_to_vec_zlib_with_limit ( & v [ .. ] , limit ) { Ok ( s ) => s , Err ( miniz_oxide :: inflate :: TINFLStatus :: HasMoreOutput ) => { return Err ( DecodingError :: from ( TextDecodingError :: OutOfDecompressionSpace , ) ) ; } Err ( _ ) => { return Err ( DecodingError :: from ( TextDecodingError :: InflationError ) ) ; } } ; self . text = OptCompressed :: Uncompressed ( String :: from_utf8 ( uncompressed_raw ) . map_err ( | _ | TextDecodingError :: Unrepresentable ) ? , ) ; } OptCompressed :: Uncompressed ( _ ) => { } } ; Ok ( ( ) ) }
Decompresses the inner text, mutating its own state.
Decompresses the inner text mutating its own state .
&mut self
limit
usize