pub struct DecodeLimits {
pub max_encoded_bytes: usize,
pub max_pixels: u64,
pub max_frames: u32,
}Expand description
DecodeLimits bounds what a decode may consume, so hostile bytes cannot exhaust memory.
Fields§
§max_encoded_bytes: usizemax_encoded_bytes bounds the input file.
max_pixels: u64max_pixels bounds one frame at its source size, before any downscale.
max_frames: u32max_frames bounds the frame count an animation may declare.
Implementations§
Source§impl DecodeLimits
impl DecodeLimits
Sourcepub fn check_source_size(self, size: [u32; 2]) -> Result<(), DecodeError>
pub fn check_source_size(self, size: [u32; 2]) -> Result<(), DecodeError>
check_source_size rejects an empty or too-large frame before any pixels are allocated.
Sourcepub fn check_frame_count(self, count: u32) -> Result<(), DecodeError>
pub fn check_frame_count(self, count: u32) -> Result<(), DecodeError>
check_frame_count rejects an image with no frames or more than the limit.
Trait Implementations§
Source§impl Clone for DecodeLimits
impl Clone for DecodeLimits
impl Copy for DecodeLimits
Source§impl Debug for DecodeLimits
impl Debug for DecodeLimits
Source§impl Default for DecodeLimits
impl Default for DecodeLimits
impl Eq for DecodeLimits
Source§impl PartialEq for DecodeLimits
impl PartialEq for DecodeLimits
impl StructuralPartialEq for DecodeLimits
Auto Trait Implementations§
impl Freeze for DecodeLimits
impl RefUnwindSafe for DecodeLimits
impl Send for DecodeLimits
impl Sync for DecodeLimits
impl Unpin for DecodeLimits
impl UnsafeUnpin for DecodeLimits
impl UnwindSafe for DecodeLimits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.