op_alloy::protocol

Trait CompressorWriter

Source
pub trait CompressorWriter {
    // Required methods
    fn write(&mut self, data: &[u8]) -> Result<usize, CompressorError>;
    fn flush(&mut self) -> Result<(), CompressorError>;
    fn close(&mut self) -> Result<(), CompressorError>;
    fn reset(&mut self);
    fn len(&self) -> usize;
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, CompressorError>;
}
Available on crate feature protocol only.
Expand description

Compressor Writer

A trait that expands the standard library Write trait to include compression-specific methods and return CompressorResult instead of standard library Result.

Required Methods§

Source

fn write(&mut self, data: &[u8]) -> Result<usize, CompressorError>

Writes the given data to the compressor.

Source

fn flush(&mut self) -> Result<(), CompressorError>

Flushes the buffer.

Source

fn close(&mut self) -> Result<(), CompressorError>

Closes the compressor.

Source

fn reset(&mut self)

Resets the compressor.

Source

fn len(&self) -> usize

Returns the length of the compressed data.

Source

fn read(&mut self, buf: &mut [u8]) -> Result<usize, CompressorError>

Reads the compressed data into the given buffer. Returns the number of bytes read.

Implementors§