[][src]Trait zstd::stream::raw::Operation

pub trait Operation {
    fn run(
        &mut self,
        input: &mut InBuffer,
        output: &mut OutBuffer
    ) -> Result<usize>; fn run_on_buffers(
        &mut self,
        input: &[u8],
        output: &mut [u8]
    ) -> Result<Status> { ... }
fn flush(&mut self, output: &mut OutBuffer) -> Result<usize> { ... }
fn reinit(&mut self) -> Result<()> { ... }
fn finish(
        &mut self,
        output: &mut OutBuffer,
        finished_frame: bool
    ) -> Result<usize> { ... } }

Represents an abstract compression/decompression operation.

This trait covers both Encoder and Decoder.

Required methods

fn run(&mut self, input: &mut InBuffer, output: &mut OutBuffer) -> Result<usize>

Performs a single step of this operation.

Should return a hint for the next input size.

If the result is Ok(0), it may indicate that a frame was just finished.

Loading content...

Provided methods

fn run_on_buffers(&mut self, input: &[u8], output: &mut [u8]) -> Result<Status>

Performs a single step of this operation.

This is a comvenience wrapper around Operation::run if you don't want to deal with InBuffer/OutBuffer.

fn flush(&mut self, output: &mut OutBuffer) -> Result<usize>

Flushes any internal buffer, if any.

Returns the number of bytes still in the buffer. To flush entirely, keep calling until it returns Ok(0).

fn reinit(&mut self) -> Result<()>

Prepares the operation for a new frame.

This is hopefully cheaper than creating a new operation.

fn finish(
    &mut self,
    output: &mut OutBuffer,
    finished_frame: bool
) -> Result<usize>

Finishes the operation, writing any footer if necessary.

Returns the number of bytes still to write.

Keep calling this method until it returns Ok(0), and then don't ever call this method.

Loading content...

Implementors

impl Operation for Decoder[src]

impl Operation for Encoder[src]

impl Operation for NoOp[src]

Loading content...