pub struct Compressor {
pub compression_type: CompressionType,
pub level: u32,
}Expand description
Compressor with configurable algorithm and level
Fields§
§compression_type: CompressionTypeCompression type
level: u32Compression level (1-9 for gzip, 1-22 for zstd)
Implementations§
Source§impl Compressor
impl Compressor
Sourcepub fn new(compression_type: CompressionType) -> Self
pub fn new(compression_type: CompressionType) -> Self
Create a new compressor with default level
Sourcepub fn with_level(self, level: u32) -> Self
pub fn with_level(self, level: u32) -> Self
Set compression level
Sourcepub fn decompress(&self, data: &[u8]) -> CompressionResult<Vec<u8>>
pub fn decompress(&self, data: &[u8]) -> CompressionResult<Vec<u8>>
Decompress data
Sourcepub fn content_encoding(&self) -> &'static str
pub fn content_encoding(&self) -> &'static str
Get the content encoding string
Trait Implementations§
Source§impl Clone for Compressor
impl Clone for Compressor
Source§fn clone(&self) -> Compressor
fn clone(&self) -> Compressor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Compressor
impl Debug for Compressor
Auto Trait Implementations§
impl Freeze for Compressor
impl RefUnwindSafe for Compressor
impl Send for Compressor
impl Sync for Compressor
impl Unpin for Compressor
impl UnwindSafe for Compressor
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