pub struct DecoderReader { /* private fields */ }Expand description
Owned parallel decoder output implementing Read and Send.
Reaching EOF means the selected container passed every available check and
makes the final DecodeReport available through
DecoderReader::report. A decoding
failure is returned as an io::Error whose source is a DecodeError.
Dropping this value cancels the background pipeline. It does not verify
unread compressed data; use DecoderReader::finish to discard unread
output while still verifying the complete stream.
A positional source is decoded by a background pipeline that is cancelled and joined on drop. A non-seekable source is decoded synchronously as this reader is pulled, so dropping it immediately drops the source and never leaves a blocked coordinator thread behind.
Implementations§
Source§impl DecoderReader
impl DecoderReader
Sourcepub fn handle(&self) -> DecoderHandle
pub fn handle(&self) -> DecoderHandle
Returns a cloneable telemetry and runtime-control handle.
The handle can be retained after moving this reader into a parser or a
Box<dyn Read + Send>.
Sourcepub fn stats(&self) -> DecoderStats
pub fn stats(&self) -> DecoderStats
Returns an approximate lock-free snapshot of decoder activity.
Sourcepub fn set_worker_limit(&self, workers: usize) -> Result<(), WorkerLimitError>
pub fn set_worker_limit(&self, workers: usize) -> Result<(), WorkerLimitError>
Changes the maximum number of workers that may accept decoder tasks.
This is a convenience forwarding method for
DecoderHandle::set_worker_limit. Retain a handle when the reader
will be moved into another component.
§Errors
Returns WorkerLimitError for zero or a value above the configured
worker budget.
Sourcepub const fn report(&self) -> Option<&DecodeReport>
pub const fn report(&self) -> Option<&DecodeReport>
Returns the report after verified EOF has been observed.
This is None while decoding is open and after a terminal failure.
Sourcepub fn finish(self) -> Result<DecodeReport, DecodeError>
pub fn finish(self) -> Result<DecodeReport, DecodeError>
Discards unread output, verifies the remaining stream, and returns its final report.
§Errors
Returns the first decoding, verification, input, or worker failure.
Trait Implementations§
Source§impl Drop for DecoderReader
impl Drop for DecoderReader
Source§impl Read for DecoderReader
impl Read for DecoderReader
Source§fn read(&mut self, output: &mut [u8]) -> Result<usize>
fn read(&mut self, output: &mut [u8]) -> Result<usize>
Source§fn read_vectored(&mut self, buffers: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_vectored(&mut self, buffers: &mut [IoSliceMut<'_>]) -> Result<usize>
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<'_, u8>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(
&mut self,
cursor: BorrowedCursor<'_, u8>,
) -> Result<(), Error>
fn read_buf_exact( &mut self, cursor: BorrowedCursor<'_, u8>, ) -> 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 more1.0.0 · Source§fn chain<R>(self, next: R) -> Chain<Self, R>
fn chain<R>(self, next: R) -> Chain<Self, R>
1.0.0 · Source§fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
limit bytes from it. Read moreSource§fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
read_array)