tiny.zen.AsciiRenderPlan
Defined in tiny.zen.
Exact, clamped storage demand for one document and option set.
API (9)
Actions
Public operations.
exactLimits: Returns the smallest limits that admit this render.inspect: Measures document scratch and clamps dimensions without allocating.require: Rejects when any measured region exceeds supplied limits.
Fields and members
Public fields and members.
Source
Source: lib/zen/src/diagram/ascii/plan.zig:19
zig
/// Exact, clamped storage demand for one document and option set.pub const Plan = struct { /// Admitted width after clamping. width: usize, /// Admitted height after clamping. height: usize, /// Categorical bound slots required by the document. categories: usize, /// Stacked-series total slots required by the document. stack_totals: usize, /// Exact canvas bytes required. canvas_bytes: usize, /// Maximum output bytes required before row compaction. output_bytes: usize, /// Measures document scratch and clamps dimensions without allocating. pub fn inspect( document: *const diagram.Document, options: model.Options, ) error{CapacityOverflow}!Plan { const width = clamp(options.width, 24, 200); const height = clamp(options.height, 8, 80); const scratch = diagram.bounds.ScratchPlan.inspect(document); return .{ .width = width, .height = height, .categories = scratch.categories, .stack_totals = scratch.stack_totals, .canvas_bytes = try multiplied(width, height), .output_bytes = try multiplied(try added(width, 1), height), }; } /// Returns the smallest limits that admit this render. pub fn exactLimits(self: Plan) Limits { return .{ .max_categories = self.categories, .max_stack_totals = self.stack_totals, .max_canvas_bytes = self.canvas_bytes, .max_output_bytes = self.output_bytes, }; } /// Rejects when any measured region exceeds supplied limits. pub fn require(self: Plan, limits: Limits) model.Exhaustion!void { if (self.categories > limits.max_categories) { return error.AsciiCategoryCapacityExceeded; } if (self.stack_totals > limits.max_stack_totals) { return error.AsciiStackTotalCapacityExceeded; } if (self.canvas_bytes > limits.max_canvas_bytes) { return error.AsciiCanvasByteCapacityExceeded; } if (self.output_bytes > limits.max_output_bytes) { return error.AsciiOutputByteCapacityExceeded; } }};Source: lib/zen/src/root.zig:67
zig
/// Exact, clamped ASCII demand for one document and option set.pub const AsciiRenderPlan = diagram.AsciiRenderPlan;Also reachable as
diagram.AsciiRenderPlan, diagram.ascii.RenderPlan.
Audit
| Definitions | 4 |
|---|---|
| Public names | 12 |
| Members | 6 |
| Version | 26.7.0 |
| Revision | daab053ee433 |