[go: up one dir, main page]

Struct zstd::block::Compressor [] [src]

pub struct Compressor {
    // some fields omitted
}

Allows to compress multiple blocks of data, re-using the context.

Methods

impl Compressor
[src]

fn new() -> Self

Creates a new zstd compressor

fn with_dict(dict: Vec<u8>) -> Self

Creates a new zstd compressor, using the given dictionary.

fn compress_to_buffer(&mut self, destination: &mut [u8], source: &[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).

fn compress(&mut self, data: &[u8], level: i32) -> Result<Vec<u8>>

Compress a block of data, and return the compressed result in a Vec<u8>.

Trait Implementations

impl Default for Compressor
[src]

fn default() -> Compressor

Returns the "default value" for a type. Read more