Struct lzzzz::lz4f::WriteDecompressor
source · pub struct WriteDecompressor<'a, W: Write> { /* private fields */ }
Expand description
The Write
-based streaming decompressor.
§Example
use lzzzz::lz4f::{compress_to_vec, WriteDecompressor};
use std::{fs::File, io::prelude::*};
let mut f = File::create("foo.txt")?;
let mut w = WriteDecompressor::new(&mut f)?;
let mut buf = Vec::new();
compress_to_vec(b"Hello world!", &mut buf, &Default::default())?;
w.write_all(&buf)?;
Implementations§
source§impl<'a, W: Write> WriteDecompressor<'a, W>
impl<'a, W: Write> WriteDecompressor<'a, W>
sourcepub fn frame_info(&self) -> Option<FrameInfo>
pub fn frame_info(&self) -> Option<FrameInfo>
Returns FrameInfo
if the frame header is already decoded.
Otherwise, returns None
.
sourcepub fn decode_header_only(&mut self, flag: bool)
pub fn decode_header_only(&mut self, flag: bool)
Sets the ‘header-only’ mode.
When the ‘header-only’ mode is enabled, the decompressor doesn’t
consume the frame body and write()
always returns Ok(0)
if the frame header is already decoded.
sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Returns ownership of the writer.
Trait Implementations§
source§impl<W> Debug for WriteDecompressor<'_, W>
impl<W> Debug for WriteDecompressor<'_, W>
source§impl<W: Write> Write for WriteDecompressor<'_, W>
impl<W: Write> Write for WriteDecompressor<'_, W>
source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. Read more
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. 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<'a, W> Freeze for WriteDecompressor<'a, W>where
W: Freeze,
impl<'a, W> RefUnwindSafe for WriteDecompressor<'a, W>where
W: RefUnwindSafe,
impl<'a, W> Send for WriteDecompressor<'a, W>where
W: Send,
impl<'a, W> !Sync for WriteDecompressor<'a, W>
impl<'a, W> Unpin for WriteDecompressor<'a, W>where
W: Unpin,
impl<'a, W> UnwindSafe for WriteDecompressor<'a, W>where
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