pub(crate) struct ReadDecoder<R: Read> {
    reader: BufReader<R>,
    decoder: StreamingDecoder,
}Expand description
Helper for encapsulating reading input from Read and feeding it into a StreamingDecoder
while hiding low-level Decoded events and only exposing a few high-level reading operations
like:
read_header_info- reading untilIHDRchunkread_until_image_data- reading untilIDAT/fdATsequencedecode_image_data- reading fromIDAT/fdATsequence intoVec<u8>finish_decoding_image_data()- discarding remaining data fromIDAT/fdATsequenceread_until_end_of_input()- reading untilIENDchunk
Fields§
§reader: BufReader<R>§decoder: StreamingDecoderImplementations§
Source§impl<R: Read> ReadDecoder<R>
 
impl<R: Read> ReadDecoder<R>
pub fn new(r: R) -> Self
pub fn with_options(r: R, options: DecodeOptions) -> Self
pub fn set_limits(&mut self, limits: Limits)
pub fn reserve_bytes(&mut self, bytes: usize) -> Result<(), DecodingError>
pub fn set_ignore_text_chunk(&mut self, ignore_text_chunk: bool)
pub fn set_ignore_iccp_chunk(&mut self, ignore_iccp_chunk: bool)
pub fn ignore_checksums(&mut self, ignore_checksums: bool)
Sourcefn decode_next(
    &mut self,
    image_data: &mut Vec<u8>,
) -> Result<Decoded, DecodingError>
 
fn decode_next( &mut self, image_data: &mut Vec<u8>, ) -> Result<Decoded, DecodingError>
Returns the next decoded chunk. If the chunk is an ImageData chunk, its contents are written into image_data.
fn decode_next_without_image_data(&mut self) -> Result<Decoded, DecodingError>
fn decode_next_and_discard_image_data( &mut self, ) -> Result<Decoded, DecodingError>
Sourcepub fn read_header_info(&mut self) -> Result<&Info<'static>, DecodingError>
 
pub fn read_header_info(&mut self) -> Result<&Info<'static>, DecodingError>
Reads until the end of IHDR chunk.
Prerequisite: None (idempotent).
Sourcepub fn read_until_image_data(&mut self) -> Result<(), DecodingError>
 
pub fn read_until_image_data(&mut self) -> Result<(), DecodingError>
Reads until the start of the next IDAT or fdAT chunk.
Prerequisite: Not within IDAT / fdAT chunk sequence.
Sourcepub fn decode_image_data(
    &mut self,
    image_data: &mut Vec<u8>,
) -> Result<ImageDataCompletionStatus, DecodingError>
 
pub fn decode_image_data( &mut self, image_data: &mut Vec<u8>, ) -> Result<ImageDataCompletionStatus, DecodingError>
Reads image_data and reports whether there may be additional data afterwards (i.e. if it
is okay to call decode_image_data and/or finish_decoding_image_data again)..
Prerequisite: Input is currently positioned within IDAT / fdAT chunk sequence.
Sourcepub fn finish_decoding_image_data(&mut self) -> Result<(), DecodingError>
 
pub fn finish_decoding_image_data(&mut self) -> Result<(), DecodingError>
Consumes and discards the rest of an IDAT / fdAT chunk sequence.
Prerequisite: Input is currently positioned within IDAT / fdAT chunk sequence.
Sourcepub fn read_until_end_of_input(&mut self) -> Result<(), DecodingError>
 
pub fn read_until_end_of_input(&mut self) -> Result<(), DecodingError>
Reads until the IEND chunk.
Prerequisite: IEND chunk hasn’t been reached yet.