pub struct Limits {
pub io_chunk_bytes: usize,
pub max_input_bytes: u64,
pub max_output_bytes: u64,
pub max_allocation_bytes: u64,
pub max_pages: u32,
pub max_bookmarks: u32,
pub max_image_pixels: u64,
pub max_symbols: u32,
}Expand description
Resource limits applied before allocation and during I/O.
These are the only resource bounds of an operation. Each public entry point validates them once; format handlers derive every other bound from these fields or from the format itself.
Fields§
§io_chunk_bytes: usizeMaximum payload per source/sink call. Must be in 1..=MAX_IO_CHUNK.
max_input_bytes: u64Maximum selected input bytes: a whole source, PDF range, or sum of fragment spans.
max_output_bytes: u64Maximum total output bytes for an operation.
max_allocation_bytes: u64Maximum single dynamic allocation requested by a format handler. It also caps one image payload, one JBIG2 symbol store and one page or region bitmap.
max_pages: u32Maximum pages accepted from an input document.
max_bookmarks: u32Maximum bookmarks accepted from an input document.
max_image_pixels: u64Maximum pixels of one decoded image, page, region or symbol bitmap.
max_symbols: u32Maximum symbols in one JBIG2 symbol dictionary, including imported symbols, and the bound on its height classes and export runs.
Implementations§
Source§impl Limits
impl Limits
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Reject invalid configurations before any I/O or allocation occurs.
Sourcepub fn check_allocation(&self, bytes: u64) -> Result<()>
pub fn check_allocation(&self, bytes: u64) -> Result<()>
Check the size of a requested single allocation.
Sourcepub fn check_input_size(&self, bytes: u64) -> Result<()>
pub fn check_input_size(&self, bytes: u64) -> Result<()>
Check the selected input byte count for one operation.
Sourcepub fn check_pages(&self, count: u32) -> Result<()>
pub fn check_pages(&self, count: u32) -> Result<()>
Check a page count before indexing or allocating pages.
Sourcepub fn check_image_pixels(&self, pixels: u64) -> Result<()>
pub fn check_image_pixels(&self, pixels: u64) -> Result<()>
Check the pixel count of one image, page, region or symbol bitmap.
Sourcepub fn check_symbols(&self, symbols: u64) -> Result<()>
pub fn check_symbols(&self, symbols: u64) -> Result<()>
Check the symbol count of one JBIG2 symbol dictionary.
Sourcepub fn check_bookmarks(&self, count: u32) -> Result<()>
pub fn check_bookmarks(&self, count: u32) -> Result<()>
Check a bookmark count before indexing or allocating bookmarks.