zpl 0.3.2

A high accuracy ZPL renderer
Documentation
//! Output budgets are independent of ZPL interpretation and printer profiles.

/// Resource ceilings for scene validation and output adapters. Set these with
/// the `*_with_limits` entry points; existing entry points use [`Self::DEFAULT`].
#[derive(Debug, Clone, Copy)]
pub struct Limits {
    pub pixels: usize,
    /// Scene segments (total across pages for PDF).
    pub segments: usize,
    pub coordinate_abs: f64,
    pub pages: usize,
    /// Edges generated by curve flattening, per draw.
    pub flattened_segments: usize,
    /// Cumulative edge/scanline visits for one rasterized scene.
    pub scan_work: u64,
}

impl Default for Limits {
    fn default() -> Self {
        Self::DEFAULT
    }
}

impl Limits {
    pub const DEFAULT: Self = Self {
        pixels: super::MAX_PIXELS,
        segments: super::MAX_SEGMENTS,
        coordinate_abs: 1e9,
        pages: 64,
        flattened_segments: super::MAX_SEGMENTS,
        scan_work: 100_000_000,
    };

    /// Disable policy ceilings. Structural validity, representable dimensions,
    /// format constraints and available memory still constrain output.
    pub const fn unlimited() -> Self {
        Self {
            pixels: usize::MAX,
            segments: usize::MAX,
            coordinate_abs: f64::MAX,
            pages: usize::MAX,
            flattened_segments: usize::MAX,
            scan_work: u64::MAX,
        }
    }
}