pub struct Compressor { /* private fields */ }Available on crate feature
extensions only.Expand description
Compressor for sync payloads
Implementations§
Source§impl Compressor
impl Compressor
Sourcepub fn with_config(config: CompressionConfig) -> Self
pub fn with_config(config: CompressionConfig) -> Self
Create a compressor with custom config
Sourcepub fn compress(&self, data: &[u8]) -> Result<CompressResult, CompressionError>
pub fn compress(&self, data: &[u8]) -> Result<CompressResult, CompressionError>
Compress data if it meets the minimum size threshold
Returns the original data if compression isn’t beneficial.
Sourcepub fn compress_into(
&self,
data: &[u8],
buf: &mut [u8],
) -> Result<(usize, bool), CompressionError>
pub fn compress_into( &self, data: &[u8], buf: &mut [u8], ) -> Result<(usize, bool), CompressionError>
Compress data in-place into a buffer
Returns the number of bytes written and whether compression was used.
Sourcepub fn decompress(&self, data: &[u8]) -> Result<Vec<u8>, CompressionError>
pub fn decompress(&self, data: &[u8]) -> Result<Vec<u8>, CompressionError>
Decompress data
Sourcepub fn decompress_with_limit(
&self,
data: &[u8],
max_size: usize,
) -> Result<Vec<u8>, CompressionError>
pub fn decompress_with_limit( &self, data: &[u8], max_size: usize, ) -> Result<Vec<u8>, CompressionError>
Decompress data with explicit size limit
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