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