Trait gzp::FormatSpec [−][src]
pub trait FormatSpec: Clone + Copy + Debug + Send + Sync + 'static {
type C: Check + Send + 'static;
fn new() -> Self;
fn needs_dict(&self) -> bool;
fn encode(
&self,
input: &[u8],
compression_level: Compression,
dict: Option<&Bytes>,
is_last: bool
) -> Result<Vec<u8>, GzpError>;
fn header(&self, compression_leval: 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
Required methods
fn needs_dict(&self) -> bool
fn needs_dict(&self) -> bool
Whether or not this format should try to use a dictionary.
How to deflate bytes for this format. Returns deflated bytes.
fn header(&self, compression_leval: Compression) -> Vec<u8>
fn header(&self, compression_leval: Compression) -> Vec<u8>
Generate a generic header for the given format.
Generate a genric footer for the format.
Provided methods
fn create_check() -> Self::C
fn create_check() -> Self::C
Create a check value for this format that implements Check