An xz encoder, or compressor.
This structure implements a
BufRead interface and will read uncompressed
data from an underlying stream and emit a stream of compressed data.
Creates a new encoder which will read uncompressed data from the given stream and emit the compressed stream.
level argument here is typically 0-9 with 6 being a good default.
pub fn new_stream(r: R, stream: Stream) -> XzEncoder<R>ⓘ[src]
Creates a new encoder with a custom
Stream can be pre-configured for multithreaded encoding, different
compression options/tuning, etc.
Acquires a reference to the underlying stream
Acquires a mutable reference to the underlying stream
Note that mutation of the stream may result in surprising results if this encoder is continued to be used.
pub fn into_inner(self) -> R[src]
Consumes this encoder, returning the underlying reader.
Returns the number of bytes produced by the compressor (e.g. the number of bytes read from this stream)
Note that, due to buffering, this only bears any relation to
total_in() when the compressor chooses to flush its data
(unfortunately, this won't happen this won't happen in general
at the end of the stream, because the compressor doesn't know
if there's more data to come). At that point,
total_out() / total_in() would be the compression ratio.
Returns the number of bytes consumed by the compressor (e.g. the number of bytes read from the underlying stream)
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>1.36.0[src]
fn is_read_vectored(&self) -> bool[src]
unsafe fn initializer(&self) -> Initializer[src]
fn is_write_vectored(&self) -> bool[src]
impl<R> RefUnwindSafe for XzEncoder<R> where
impl<R> UnwindSafe for XzEncoder<R> where
type Error = Infallible
The type returned in the event of a conversion error.