pub struct ResourceLimits {
pub max_data_length: usize,
pub max_version: Version,
pub max_render_size: (u32, u32),
}Expand description
Explicit resource budgets for bounded QR-code construction.
QrCode::with_limits
applies these limits before allocating encoder state and after selecting
the resulting symbol dimensions. The dimensions are the maximum width and
height of the symbol passed to a renderer; a renderer may impose a stricter
pixel budget of its own.
Fields§
§max_data_length: usizeMaximum number of input bytes accepted before parsing or allocation.
max_version: VersionMaximum normal QR version considered by automatic version selection.
max_render_size: (u32, u32)Maximum (width, height) accepted for the generated module symbol.
Implementations§
Source§impl ResourceLimits
impl ResourceLimits
Sourcepub const fn new(
max_data_length: usize,
max_version: Version,
max_render_size: (u32, u32),
) -> Self
pub const fn new( max_data_length: usize, max_version: Version, max_render_size: (u32, u32), ) -> Self
Creates an explicit resource budget.
Sourcepub fn validate(self) -> QrResult<()>
pub fn validate(self) -> QrResult<()>
Validates the shape of this budget without inspecting input data.
Automatic construction currently targets normal QR versions, so Micro versions are rejected here rather than being silently interpreted as a normal-version cap. Zero render dimensions cannot describe a symbol.
Trait Implementations§
Source§impl Clone for ResourceLimits
impl Clone for ResourceLimits
Source§fn clone(&self) -> ResourceLimits
fn clone(&self) -> ResourceLimits
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more