pub trait Compressor {
type CompressorError: Sized + Error;
// Required methods
fn encode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, Self::CompressorError>;
fn decode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, Self::CompressorError>;
fn into_string(&self) -> Option<String>;
}Expand description
Compressor trait that defines functionality which should be provided by typical compressor.
Required Associated Types§
type CompressorError: Sized + Error
Required Methods§
Sourcefn encode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, Self::CompressorError>
fn encode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, Self::CompressorError>
Encodes given bytes and returns Result that contains either
encoded data or an error which occures during the transformation.
Sourcefn decode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, Self::CompressorError>
fn decode(&self, bytes: Vec<u8>) -> Result<Vec<u8>, Self::CompressorError>
Encodes given encoded data and returns Result that contains either
encoded bytes or an error which occures during the transformation.
Sourcefn into_string(&self) -> Option<String>
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 server returns in a response to
Options request.