[][src]Trait cdrs::compression::Compressor

pub trait Compressor {
    fn encode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, CompressionError>;
fn decode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, CompressionError>;
fn into_string(&self) -> Option<String>; }

Compressor trait that defines functionality which should be provided by typical compressor.

Required methods

fn encode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, CompressionError>

Encodes given bytes and returns Result that contains either encoded data or an error which occures during the transformation.

fn decode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, CompressionError>

Encodes given encoded data and returns Result that contains either encoded bytes or an error which occures during the transformation.

fn into_string(&self) -> Option<String>

Returns a string which is a name of a compressor. This name should be exactly the same as one which returns a server in a response to Options request.

Loading content...

Implementors

Loading content...