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§

source

type Encoder<W: Write>: Write

The encoder wrapper type that compresses data sent to the contained writer.

source

type Decoder<R: Read>: Read

The decoder wrapper type that decompresses data sent from the contained reader.

Required Methods§

source

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.

source

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.
§

type Encoder<W: Write> = BzEncoder<W>

§

type Decoder<R: Read> = BzDecoder<R>

source§

impl CompressionFormat for Deflate

Available on crate feature flate only.
source§

impl CompressionFormat for Gz

Available on crate feature flate only.
§

type Encoder<W: Write> = GzEncoder<W>

§

type Decoder<R: Read> = GzDecoder<R>

source§

impl CompressionFormat for ZLib

Available on crate feature flate only.
source§

impl CompressionFormat for Xz

Available on crate feature xz only.
§

type Encoder<W: Write> = XzEncoder<W>

§

type Decoder<R: Read> = XzDecoder<R>