Struct StreamingDecoder

pub struct StreamingDecoder { /* private fields */ }

PNG StreamingDecoder (low-level interface)

By default, the decoder does not verify Adler-32 checksum computation. To enable checksum verification, set it with StreamingDecoder::set_ignore_adler32 before starting decompression.

Implementations

impl StreamingDecoder

fn new() -> StreamingDecoder

Creates a new StreamingDecoder

Allocates the internal buffers.

fn new_with_options(decode_options: DecodeOptions) -> StreamingDecoder
fn reset(&mut self)

Resets the StreamingDecoder

fn info(&self) -> Option<&Info<'static>>

Provides access to the inner info field

fn set_ignore_text_chunk(&mut self, ignore_text_chunk: bool)
fn set_ignore_iccp_chunk(&mut self, ignore_iccp_chunk: bool)
fn ignore_adler32(&self) -> bool

Return whether the decoder is set to ignore the Adler-32 checksum.

fn set_ignore_adler32(&mut self, ignore_adler32: bool) -> bool

Set whether to compute and verify the Adler-32 checksum during decompression. Return true if the flag was successfully set.

The decoder defaults to true.

This flag cannot be modified after decompression has started until the StreamingDecoder is reset.

fn set_ignore_crc(&mut self, ignore_crc: bool)

Set whether to compute and verify the Adler-32 checksum during decompression.

The decoder defaults to false.

fn set_skip_ancillary_crc_failures(&mut self, skip_ancillary_crc_failures: bool)

Ignore ancillary chunks if CRC fails

Defaults to true

fn update(&mut self, buf: &[u8], image_data: Option<&mut UnfilterBuf<'_>>) -> Result<(usize, Decoded), DecodingError>

Low level StreamingDecoder interface.

Allows to stream partial data to the encoder. Returns a tuple containing the bytes that have been consumed from the input buffer and the current decoding result. If the decoded chunk was an image data chunk, it also appends the read data to image_data.

Trait Implementations

impl Default for StreamingDecoder

fn default() -> Self

Auto Trait Implementations

impl Freeze for StreamingDecoder

impl RefUnwindSafe for StreamingDecoder

impl Send for StreamingDecoder

impl Sync for StreamingDecoder

impl Unpin for StreamingDecoder

impl UnsafeUnpin for StreamingDecoder

impl UnwindSafe for StreamingDecoder

Blanket Implementations

impl<T> Any for StreamingDecoder where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for StreamingDecoder where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for StreamingDecoder where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for StreamingDecoder

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for StreamingDecoder where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for StreamingDecoder where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for StreamingDecoder where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>