Trait CompressionFormat

Source
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>;
}
Available on crate feature compression only.
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl CompressionFormat for BZip2

Available on crate feature bzip only.
Source§

impl CompressionFormat for Deflate

Available on crate feature flate only.
Source§

impl CompressionFormat for Gz

Available on crate feature flate only.
Source§

impl CompressionFormat for ZLib

Available on crate feature flate only.
Source§

impl CompressionFormat for Xz

Available on crate feature xz only.