Struct zstd::block::Compressor
source · [−]pub struct Compressor { /* private fields */ }
Expand description
Allows to compress independently multiple blocks of data.
This reduces memory usage compared to calling compress
multiple times.
The compressed blocks are still completely independent.
Implementations
sourceimpl Compressor
impl Compressor
sourcepub fn with_dict(dict: Vec<u8>) -> Self
pub fn with_dict(dict: Vec<u8>) -> Self
Creates a new zstd compressor, using the given dictionary.
sourcepub fn compress_to_buffer(
&mut self,
source: &[u8],
destination: &mut [u8],
level: i32
) -> Result<usize>
pub fn compress_to_buffer(
&mut self,
source: &[u8],
destination: &mut [u8],
level: i32
) -> Result<usize>
Compress a single block of data to the given destination buffer.
Returns the number of bytes written, or an error if something happened (for instance if the destination buffer was too small).
A level of 0
uses zstd’s default (currently 3
).
Trait Implementations
sourceimpl Default for Compressor
impl Default for Compressor
sourcefn default() -> Compressor
fn default() -> Compressor
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for Compressor
impl Send for Compressor
impl !Sync for Compressor
impl Unpin for Compressor
impl UnwindSafe for Compressor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more