pub struct Compressor<W: Write> { /* private fields */ }Expand description
A Write that compresses into an inner sink.
You must call Compressor::finish to flush the final frame and get a
clean, decodable stream. As a safety net the frame is also finalized on drop
(best-effort, errors ignored), but relying on that discards any I/O error —
prefer finish.
Implementations§
Source§impl<W: Write> Compressor<W>
impl<W: Write> Compressor<W>
Trait Implementations§
Source§impl<W: Write> Drop for Compressor<W>
impl<W: Write> Drop for Compressor<W>
Source§impl<W: Write> Write for Compressor<W>
impl<W: Write> Write for Compressor<W>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes the codec, then the sink: everything written so far reaches
the sink in decodable form, and the frame stays open for more writes
(as flate2’s flush does). Each flush costs a few bytes of output.
Returns an io::ErrorKind::Unsupported error for Snappy and Bz2,
which can’t flush mid-stream.
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl<W> !Send for Compressor<W>
impl<W> !Sync for Compressor<W>
impl<W> Freeze for Compressor<W>
impl<W> RefUnwindSafe for Compressor<W>where
Option<W>: RefUnwindSafe,
impl<W> Unpin for Compressor<W>
impl<W> UnsafeUnpin for Compressor<W>where
Option<W>: UnsafeUnpin,
impl<W> UnwindSafe for Compressor<W>where
Option<W>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more