pub trait Decompressible {
// Required methods
fn decompress(&self) -> Result<Vec<u8>>;
fn decompress_lz4_block(&self, uncompressed_size: usize) -> Result<Vec<u8>>;
}Expand description
Internal trait to implement decompression over a data type.
See also Compressible for the reverse operation.
Required Methods§
Sourcefn decompress(&self) -> Result<Vec<u8>>
fn decompress(&self) -> Result<Vec<u8>>
This function decompress the provided data, returning the decompressed data, or an error if the decompression failed.
Compression format is auto-detected using each format’s magic numbers. See CompressionFormat for details
on the supported formats.
§Returns
A Vec<u8> containing the decompressed data, or an error if decompression failed.
Sourcefn decompress_lz4_block(&self, uncompressed_size: usize) -> Result<Vec<u8>>
fn decompress_lz4_block(&self, uncompressed_size: usize) -> Result<Vec<u8>>
This function decompress the provided CompressionFormat::Lz4Block data, returning the decompressed data, or an error if the decompression failed.
This format cannot be auto-detected, as it has neither magic number nor size header, so it needs its own function.
§Arguments
uncompressed_size- The size of the data once decompressed. Decompression fails if the result doesn’t match it.
§Returns
A Vec<u8> containing the decompressed data, or an error if decompression failed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".