tiny.zen.Diagnostic
Defined in diagnostic.
Fixed-capacity detail for a failed page, equation, heading, or inline feature.
API (16)
Actions
Public operations.
equation: Returns the captured equation, truncated with an ellipsis if needed.inlineSource: Returns a bounded UTF-8-safe source prefix for context, not indexing.page: Returns the page path, truncated with an ellipsis if needed.reset: Clears captured detail before a retry or unrelated operation.setEquationsetHeadingsetInlinesetPage
Fields and members
Public fields and members.
Source
Source: lib/zen/src/diagnostic.zig:13
zig
/// Fixed-capacity detail for a failed page, equation, heading, or inline feature.////// Supply its address through Markdown or site options. After an error, inspect/// `page()`, the feature source, `reason`, and `offset`, then call `reset` before/// reuse.pub const Diagnostic = struct { page_buffer: [max_page_bytes]u8 = undefined, page_len: usize = 0, equation_buffer: [max_equation_bytes]u8 = undefined, equation_len: usize = 0, inline_buffer: [max_inline_bytes]u8 = undefined, inline_len: usize = 0, /// Short cause suitable for a repair message; empty when no detail is captured. reason: []const u8 = "", /// Byte offset in the original inline source, heading feature, or equation. /// It can lie beyond a bounded or sanitized captured excerpt. offset: usize = 0, /// Returns the page path, truncated with an ellipsis if needed. pub fn page(self: *const Diagnostic) []const u8 { return self.page_buffer[0..self.page_len]; } /// Returns the captured equation, truncated with an ellipsis if needed. pub fn equation(self: *const Diagnostic) []const u8 { return self.equation_buffer[0..self.equation_len]; } /// Returns a bounded UTF-8-safe source prefix for context, not indexing. /// Invalid bytes become `?` and excess source ends in `...`. pub fn inlineSource(self: *const Diagnostic) []const u8 { return self.inline_buffer[0..self.inline_len]; } /// Clears captured detail before a retry or unrelated operation. pub fn reset(self: *Diagnostic) void { self.* = .{}; } pub fn setPage(self: *Diagnostic, path: []const u8) void { self.page_len = copyEllipsized(&self.page_buffer, path); } pub fn setEquation(self: *Diagnostic, source: []const u8, detail: math.Diagnostic) void { self.equation_len = copyEllipsized(&self.equation_buffer, source); self.inline_len = 0; self.reason = detail.reason; self.offset = detail.offset; } pub fn setHeading(self: *Diagnostic, reason: []const u8, offset: usize) void { self.equation_len = 0; self.inline_len = 0; self.reason = reason; self.offset = offset; } pub fn setInline(self: *Diagnostic, source: []const u8, reason: []const u8, offset: usize) void { self.equation_len = 0; self.inline_len = copyEllipsized(&self.inline_buffer, source); self.reason = reason; self.offset = offset; }};Source: lib/zen/src/root.zig:340
zig
/// Fixed-capacity source-local detail for rendering and publication failures.pub const Diagnostic = diagnostic.Diagnostic;Also reachable as
Audit
| Definitions | 9 |
|---|---|
| Public names | 27 |
| Members | 8 |
| Version | 26.7.0 |
| Revision | daab053ee433 |