Type Alias Limits

pub type Limits = Limits;
👎Deprecated: this type has been moved to image::Limits
Available on crate feature dep_image only.
Expand description

Deprecated re-export of Limits

Aliased Type§

struct Limits {
    pub max_image_width: Option<u32>,
    pub max_image_height: Option<u32>,
    pub max_alloc: Option<u64>,
}

Fields§

§max_image_width: Option<u32>

The maximum allowed image width. This limit is strict. The default is no limit.

§max_image_height: Option<u32>

The maximum allowed image height. This limit is strict. The default is no limit.

§max_alloc: Option<u64>

The maximum allowed sum of allocations allocated by the decoder at any one time excluding allocator overhead. This limit is non-strict by default and some decoders may ignore it. The bytes required to store the output image count towards this value. The default is 512MiB.

Implementations

§

impl Limits

pub fn no_limits() -> Limits

Disable all limits.

pub fn check_support(&self, _supported: &LimitSupport) -> Result<(), ImageError>

This function checks that all currently set strict limits are supported.

pub fn check_dimensions( &self, width: u32, height: u32, ) -> Result<(), ImageError>

This function checks the max_image_width and max_image_height limits given the image width and height.

pub fn reserve(&mut self, amount: u64) -> Result<(), ImageError>

This function checks that the current limit allows for reserving the set amount of bytes, it then reduces the limit accordingly.

pub fn reserve_usize(&mut self, amount: usize) -> Result<(), ImageError>

This function acts identically to reserve, but takes a usize for convenience.

pub fn reserve_buffer( &mut self, width: u32, height: u32, color_type: ColorType, ) -> Result<(), ImageError>

This function acts identically to reserve, but accepts the width, height and color type used to create an ImageBuffer and does all the math for you.

pub fn free(&mut self, amount: u64)

This function increases the max_alloc limit with amount. Should only be used together with reserve.

pub fn free_usize(&mut self, amount: usize)

This function acts identically to free, but takes a usize for convenience.

Trait Implementations

§

impl Clone for Limits

§

fn clone(&self) -> Limits

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Limits

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for Limits

§

fn default() -> Limits

Returns the “default value” for a type. Read more
§

impl Hash for Limits

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for Limits

§

fn eq(&self, other: &Limits) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for Limits

§

impl StructuralPartialEq for Limits