pub struct CompressionEngine { /* private fields */ }
Expand description
Compression engine for data compression/decompression
Implementations§
Source§impl CompressionEngine
impl CompressionEngine
Sourcepub fn with_level(level: u32) -> Self
pub fn with_level(level: u32) -> Self
Create a new compression engine with specified compression level (0-9)
Sourcepub fn compress(&self, data: &[u8]) -> Result<Vec<u8>, CompressionError>
pub fn compress(&self, data: &[u8]) -> Result<Vec<u8>, CompressionError>
Compress data using gzip
Sourcepub fn decompress(
&self,
compressed_data: &[u8],
) -> Result<Vec<u8>, CompressionError>
pub fn decompress( &self, compressed_data: &[u8], ) -> Result<Vec<u8>, CompressionError>
Decompress gzip data
Sourcepub fn estimate_ratio(&self, data: &[u8]) -> Result<f64, CompressionError>
pub fn estimate_ratio(&self, data: &[u8]) -> Result<f64, CompressionError>
Estimate compression ratio for given data
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompressionEngine
impl RefUnwindSafe for CompressionEngine
impl Send for CompressionEngine
impl Sync for CompressionEngine
impl Unpin for CompressionEngine
impl UnwindSafe for CompressionEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more