Trait gzp::FormatSpec[][src]

pub trait FormatSpec: Clone + Copy + Debug + Send + Sync + 'static {
    type C: Check + Send + 'static;
    type Compressor;

    const DEFAULT_BUFSIZE: usize;

    fn new() -> Self;
fn needs_dict(&self) -> bool;
fn create_compressor(
        &self,
        compression_level: Compression
    ) -> Result<Self::Compressor, GzpError>;
fn encode(
        &self,
        input: &[u8],
        encoder: &mut Self::Compressor,
        compression_level: Compression,
        dict: Option<&Bytes>,
        is_last: bool
    ) -> Result<Vec<u8>, GzpError>;
fn header(&self, compression_level: Compression) -> Vec<u8>;
fn footer(&self, check: &Self::C) -> Vec<u8>; fn create_check() -> Self::C { ... }
fn to_bytes(&self, pairs: &[Pair]) -> Vec<u8> { ... } }
Expand description

Defines how to write the header and footer for each format.

Associated Types

The Check type for this format.

Associated Constants

The default buffersize to use for this format

Required methods

Create a new instance of this format spec

Whether or not this format should try to use a dictionary.

Create a thread local compressor

How to deflate bytes for this format. Returns deflated bytes.

Generate a generic header for the given format.

Generate a genric footer for the format.

Provided methods

Create a check value for this format that implements Check

Convert a list of Pair into bytes.

Implementors