pub struct Limits {Show 20 fields
pub max_text_bytes: usize,
pub max_definitions: usize,
pub max_palette_colors: usize,
pub max_sprite_side: u32,
pub max_layers: usize,
pub max_frames: usize,
pub max_tiles: usize,
pub max_map_side: u32,
pub max_glyphs: usize,
pub max_kerning_pairs: usize,
pub max_export_files: usize,
pub max_screen_items: usize,
pub max_scene_commands: usize,
pub max_scene_pixels: u64,
pub max_scene_work: u64,
pub max_scatter_attempts: u64,
pub max_nesting: usize,
pub max_image_side: u32,
pub max_image_pixels: u64,
pub max_warnings: usize,
}Expand description
Bounds on input and output, checked while text is parsed, before images are allocated and while PNG files are decoded.
The defaults suit hand-written files and untrusted input. Raise them for trusted input that needs more:
use spritebox::{Document, Limits};
let limits = Limits { max_sprite_side: 4096, ..Limits::default() };
let document = Document::parse_with("palette p\n x #ff0000\n", &limits)?;Fields§
§max_text_bytes: usizeLength of the text in bytes. Default 4 MiB.
max_definitions: usizeNumber of top-level definitions: palettes, sprites and so on. Default 4096.
max_palette_colors: usizeKeys in one palette, inherited keys included. Default 256.
max_sprite_side: u32Width or height of one sprite in pixels. Default 1024.
max_layers: usizeLayers in one sprite, layers of sprites used as layers included. Default 16.
max_frames: usizeFrames in one animation. Default 1024.
max_tiles: usizeTiles in one tileset, terrain variants included. Default 4096.
max_map_side: u32Width or height of one tilemap in tiles. Default 1024.
max_glyphs: usizeGlyphs in one font. Default 4096.
max_kerning_pairs: usizeKerning pairs in one font. Default 4096.
max_export_files: usizeFiles in an export, including theme variants. Default 8192.
max_screen_items: usizePlacements in one screen. Default 1024.
max_scene_commands: usizeAuthored scene operations and list records. Default 4096.
max_scene_pixels: u64Retained scene cells, profile entries, placements and operation images. Default 16 Mi.
max_scene_work: u64Raster samples, edge tests, noise octaves and scatter work per operation. Default 64 Mi.
max_scatter_attempts: u64Candidate attempts across all scatter groups in a document. Default 1,000,000.
max_nesting: usizeDepth of definitions built on other definitions: palettes copied from=
another, and sprites derived from sprites. Default 32.
max_image_side: u32Width or height of any image the crate creates or decodes, previews and atlases included. Default 8192.
max_image_pixels: u64Pixels of any image the crate creates or decodes, and of all the sprites of a document together. Default 16 Mi (64 MiB of RGBA8).
max_warnings: usizeWarnings that Document::lint keeps; its counts
include those left out. Default 1000.