Struct DeflateEncoder
struct DeflateEncoder<R> { ... }
A DEFLATE encoder, or compressor.
This structure implements a Read interface. When read from, it reads
uncompressed data from the underlying Read and provides the compressed data.
Examples
use *;
use io;
use Compression;
use DeflateEncoder;
#
#
// Return a vector containing the Deflate compressed version of hello world
Implementations
impl<R> DeflateEncoder<R>
fn reset(self: &mut Self, r: R) -> RResets the state of this encoder entirely, swapping out the input stream for another.
This function will reset the internal state of this encoder and replace the input stream with the one provided, returning the previous input stream. Future data read from this encoder will be the compressed version of
r's data.Note that there may be currently buffered data when this function is called, and in that case the buffered data is discarded.
fn get_ref(self: &Self) -> &RAcquires a reference to the underlying reader
fn get_mut(self: &mut Self) -> &mut RAcquires 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.
fn into_inner(self: Self) -> RConsumes this encoder, returning the underlying reader.
Note that there may be buffered bytes which are not re-acquired as part of this transition. It's recommended to only call this function after EOF has been reached.
fn total_in(self: &Self) -> u64Returns the number of bytes that have been read into this compressor.
Note that not all bytes read from the underlying object may be accounted for, there may still be some active buffering.
fn total_out(self: &Self) -> u64Returns the number of bytes that the compressor has produced.
Note that not all bytes may have been read yet, some may still be buffered.
impl<R: Read> DeflateEncoder<R>
fn new(r: R, level: Compression) -> DeflateEncoder<R>Creates a new encoder which will read uncompressed data from the given stream and emit the compressed stream.
impl<R> Freeze for DeflateEncoder<R>
impl<R> RefUnwindSafe for DeflateEncoder<R>
impl<R> Send for DeflateEncoder<R>
impl<R> Sync for DeflateEncoder<R>
impl<R> Unpin for DeflateEncoder<R>
impl<R> UnsafeUnpin for DeflateEncoder<R>
impl<R> UnwindSafe for DeflateEncoder<R>
impl<R: $crate::fmt::Debug> Debug for DeflateEncoder<R>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<R: Read> Read for DeflateEncoder<R>
fn read(self: &mut Self, buf: &mut [u8]) -> Result<usize>
impl<T> Any for DeflateEncoder<R>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for DeflateEncoder<R>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for DeflateEncoder<R>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for DeflateEncoder<R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for DeflateEncoder<R>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for DeflateEncoder<R>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for DeflateEncoder<R>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<W: Read + Write> Write for DeflateEncoder<W>
fn write(self: &mut Self, buf: &[u8]) -> Result<usize>fn flush(self: &mut Self) -> Result<()>