Struct DecodeOptions
pub struct DecodeOptions { /* private fields */ }
Options for opening a GIF decoder. DecodeOptions::read_info will start the decoder.
Implementations
impl DecodeOptions
fn new() -> SelfCreates a new decoder builder
fn set_color_output(&mut self, color: ColorOutput)Configure how color data is decoded.
fn set_memory_limit(&mut self, limit: MemoryLimit)Configure a memory limit for decoding.
fn check_frame_consistency(&mut self, check: bool)Configure if frames must be within the screen descriptor.
The default is
false.When turned on, all frame descriptors being read must fit within the screen descriptor or otherwise an error is returned and the stream left in an unspecified state.
When turned off, frames may be arbitrarily larger or offset in relation to the screen. Many other decoder libraries handle this in highly divergent ways. This moves all checks to the caller, for example to emulate a specific style.
fn skip_frame_decoding(&mut self, skip: bool)Configure whether to skip decoding frames.
The default is false.
When turned on, LZW decoding is skipped.
Decoder::read_next_framewill return compressed LZW bytes in frame's data.Decoder::next_frame_infowill return the metadata of the next frame as usual. This is useful to count frames without incurring the overhead of decoding.fn check_lzw_end_code(&mut self, check: bool)Configure if LZW encoded blocks must end with a marker end code.
The default is
false.When turned on, all image data blocks—which are LZW encoded—must contain a special bit sequence signalling the end of the data. LZW processing terminates when this code is encountered. The specification states that it must be the last code output by the encoder for an image.
When turned off then image data blocks can simply end. Note that this might silently ignore some bits of the last or second to last byte.
fn allow_unknown_blocks(&mut self, check: bool)Configure if unknown blocks are allowed to be decoded.
The default is
false.When turned on, the decoder will allow unknown blocks to be in the
BlockStartposition.When turned off, decoded block starts must mark an
Image,Extension, orTrailerblock. Otherwise, the decoded image will return an error. If an unknown block error is returned from decoding, enabling this setting may allow for a further state of decoding on the next attempt.This option also allows unknown extension blocks. The decoder assumes the follow the same block layout, i.e. a sequence of zero-length terminated sub-blocks immediately follow the extension introducer.
fn read_info<R: Read>(self, r: R) -> Result<Decoder<R>, DecodingError>Reads the logical screen descriptor including the global color palette
Returns a
Decoder. All decoder configuration has to be done beforehand.
Trait Implementations
impl Clone for DecodeOptions
fn clone(&self) -> DecodeOptions
impl Debug for DecodeOptions
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for DecodeOptions
fn default() -> Self
Auto Trait Implementations
impl Freeze for DecodeOptions
impl RefUnwindSafe for DecodeOptions
impl Send for DecodeOptions
impl Sync for DecodeOptions
impl Unpin for DecodeOptions
impl UnsafeUnpin for DecodeOptions
impl UnwindSafe for DecodeOptions
Blanket Implementations
impl<T> Any for DecodeOptions
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for DecodeOptions
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for DecodeOptions
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for DecodeOptions
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for DecodeOptions
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for DecodeOptions
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for DecodeOptions
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for DecodeOptions
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for DecodeOptions
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>