Skip to main content

DecodeLimits

Struct DecodeLimits 

Source
#[non_exhaustive]
pub struct DecodeLimits { pub max_grid_points_decoded: Option<u32>, pub max_tiles_decoded: Option<u32>, }
Expand description

User-configurable limits for decoding. Use this struct if your application requires resource guards.

For example, resource guarding is likely unnecessary for applications running on a personal computing environment with ample memory. It is also unnecessary when you know that the input data contains only a small number of grid points. On the other hand, resource guarding is recommended for applications running on shared computing environments or when processing input data containing a large number of grid points from an unknown source.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§max_grid_points_decoded: Option<u32>

Maximum number of grid points to be decoded per submessage. None means no additional limit.

According to the GRIB2 specification, a single submessage can contain up to u32::MAX grid points (although the developers of this library have never encountered a submessage containing that many grid points). Depending on the decoding method, it may be necessary to allocate a large buffer to store the values of all grid points. If u32::MAX grid points are stored as an f32 array, a 16 GiB buffer is required.

This configuration option is intended to prevent such massive allocations. It is currently effective in the Template 5.40/7.40 (JPEG 2000 code stream format) decoder when jpeg2000-unpack-with-hayro is enabled.

§max_tiles_decoded: Option<u32>

Maximum number of JPEG 2000 code stream tiles to be decoded per submessage. None means no additional limit.

This configuration is currently effective in the Template 5.40/7.40 (JPEG 2000 code stream format) decoder when jpeg2000-unpack-with-hayro is enabled.

Trait Implementations§

Source§

impl Clone for DecodeLimits

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DecodeLimits

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for DecodeLimits

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.