pub type Limits = Limits;
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
Source§impl Limits
impl Limits
Sourcepub fn check_support(&self, _supported: &LimitSupport) -> ImageResult<()>
pub fn check_support(&self, _supported: &LimitSupport) -> ImageResult<()>
This function checks that all currently set strict limits are supported.
Sourcepub fn check_dimensions(&self, width: u32, height: u32) -> ImageResult<()>
pub fn check_dimensions(&self, width: u32, height: u32) -> ImageResult<()>
This function checks the max_image_width
and max_image_height
limits given
the image width and height.
Sourcepub fn reserve(&mut self, amount: u64) -> ImageResult<()>
pub fn reserve(&mut self, amount: u64) -> ImageResult<()>
This function checks that the current limit allows for reserving the set amount of bytes, it then reduces the limit accordingly.
Sourcepub fn reserve_usize(&mut self, amount: usize) -> ImageResult<()>
pub fn reserve_usize(&mut self, amount: usize) -> ImageResult<()>
This function acts identically to reserve
, but takes a usize
for convenience.
Sourcepub fn reserve_buffer(
&mut self,
width: u32,
height: u32,
color_type: ColorType,
) -> ImageResult<()>
pub fn reserve_buffer( &mut self, width: u32, height: u32, color_type: ColorType, ) -> ImageResult<()>
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.
Sourcepub fn free(&mut self, amount: u64)
pub fn free(&mut self, amount: u64)
This function increases the max_alloc
limit with amount. Should only be used
together with reserve
.
Sourcepub fn free_usize(&mut self, amount: usize)
pub fn free_usize(&mut self, amount: usize)
This function acts identically to free
, but takes a usize
for convenience.