pub trait CompressionFormat {
type Encoder<W: Write>: Write;
type Decoder<R: Read>: Read;
// Required methods
fn encode_writer<W: Write>(&self, writer: W, level: u32) -> Self::Encoder<W>;
fn decode_reader<R: Read>(&self, reader: R) -> Self::Decoder<R>;
}
Expand description
Defines a format for lossless compression of arbitrary data.
In order to use a CompressionFormat
, you may consider using the Compressed
struct.
Required Associated Types§
Required Methods§
sourcefn encode_writer<W: Write>(&self, writer: W, level: u32) -> Self::Encoder<W>
fn encode_writer<W: Write>(&self, writer: W, level: u32) -> Self::Encoder<W>
Wraps a writer that takes uncompressed data, producing a new writer that outputs compressed data.
sourcefn decode_reader<R: Read>(&self, reader: R) -> Self::Decoder<R>
fn decode_reader<R: Read>(&self, reader: R) -> Self::Decoder<R>
Wraps a reader that takes compressed data, producing a new reader that outputs uncompressed data.
Object Safety§
This trait is not object safe.
Implementors§
source§impl CompressionFormat for BZip2
Available on crate feature bzip
only.
impl CompressionFormat for BZip2
Available on crate feature
bzip
only.source§impl CompressionFormat for Deflate
Available on crate feature flate
only.
impl CompressionFormat for Deflate
Available on crate feature
flate
only.type Encoder<W: Write> = DeflateEncoder<W>
type Decoder<R: Read> = DeflateDecoder<R>
source§impl CompressionFormat for Gz
Available on crate feature flate
only.
impl CompressionFormat for Gz
Available on crate feature
flate
only.source§impl CompressionFormat for ZLib
Available on crate feature flate
only.
impl CompressionFormat for ZLib
Available on crate feature
flate
only.