pub struct CompressState { /* private fields */ }
Expand description
Holds state for performing compression operations
This is only needed just in case stack overflows occur because the object is too big
Implementations§
Source§impl CompressState
impl CompressState
Sourcepub fn new_boxed() -> Box<Self>
pub fn new_boxed() -> Box<Self>
Allocate a new compression state specifically on the heap
This is a workaround for non-guaranteed copy elision / RVO.
Sourcepub fn compress_to_buf(
&mut self,
inp: &[u8],
outp: &mut [u8],
level: CompressionLevel,
) -> Result<usize, CompressError>
pub fn compress_to_buf( &mut self, inp: &[u8], outp: &mut [u8], level: CompressionLevel, ) -> Result<usize, CompressError>
Compress the input into a preallocated buffer
Returns the compressed size on success, or an error otherwise
Sourcepub fn compress_to_vec(
&mut self,
inp: &[u8],
level: CompressionLevel,
) -> Result<Vec<u8>, CompressError>
pub fn compress_to_vec( &mut self, inp: &[u8], level: CompressionLevel, ) -> Result<Vec<u8>, CompressError>
Decompress the input into a Vec
Returns the result on success, or an error otherwise
Auto Trait Implementations§
impl Freeze for CompressState
impl RefUnwindSafe for CompressState
impl Send for CompressState
impl Sync for CompressState
impl Unpin for CompressState
impl UnwindSafe for CompressState
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