pub struct Decoder<R> { /* private fields */ }Expand description
Streaming LZ4 frame decoder wrapping an inner Read source.
Pull bytes via the Read impl; the decoder transparently reads from
the source, feeds compressed input into LZ4F_decompress, and emits
decompressed bytes into the caller’s buffer. When the frame ends,
further reads return Ok(0). Call finish to
recover the inner reader and confirm the frame was fully consumed.
Implementations§
Source§impl<R: Read> Decoder<R>
impl<R: Read> Decoder<R>
Sourcepub fn new(r: R) -> Result<Decoder<R>>
pub fn new(r: R) -> Result<Decoder<R>>
Creates a new decoder which reads its input from the given
input stream. The input stream can be re-acquired by calling
finish()
Sourcepub fn finish(self) -> (R, Result<()>)
pub fn finish(self) -> (R, Result<()>)
Returns the wrapped reader together with a status result.
The result is Ok(()) if the LZ4 frame was fully consumed (the
frame footer and any content checksum were read and accepted) and
Err(ErrorKind::Interrupted) if finish was called before the end
of the compressed stream.
Trait Implementations§
Source§impl<R: Read> Read for Decoder<R>
impl<R: Read> Read for Decoder<R>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read more