Struct zstd::block::Compressor [−][src]
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
impl Compressor
[src][−]
pub fn new() -> Self
[src][−]
Creates a new zstd compressor
pub fn with_dict(dict: Vec<u8>) -> Self
[src][−]
Creates a new zstd compressor, using the given dictionary.
pub fn compress_to_buffer(
&mut self,
source: &[u8],
destination: &mut [u8],
level: i32
) -> Result<usize>
[src][−]
&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
).
pub fn compress(&mut self, data: &[u8], level: i32) -> Result<Vec<u8>>
[src][−]
Compresses a block of data and returns the compressed result.
A level of 0
uses zstd’s default (currently 3
).
Trait Implementations
impl Default for Compressor
[src][+]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,