Silk

silk/native_report

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu.

Bounded, allocation-free native terminal-report formatting through source descriptors.

When to use

Construct one writer for one terminal report after selecting its output descriptor and limits. Feed compiler-provided identities, origins and logical frames in their semantic order.

Gotchas

This writer borrows the descriptor and never closes it. Output failure may follow a committed prefix. Reporting does not inspect error payloads or change a trap into a typed failure.

Import as NativeReport with import silk.native_report { NativeReport }.

Public declarations: 1.

NativeReport

pub struct NativeReport

Per-report output limits and success state, with no process-global storage.

Associated function NativeReport.make

pub fn make(fd: i32, byteLimit: usize, frameLimit: usize) -> NativeReport

Creates an independent writer borrowing fd, with explicit byte and caller-frame limits.

Details

Construction allocates nothing. Limits apply across the primary report and its causes.

Method NativeReport.unhandled

pub effect<'env> fn unhandled<'life0: 'env, 'life1: 'env, 'life2: 'env, 'env>(self: &'life0 mut NativeReport, identity: string<'life1>, source: string<'life2>) -> bool

Writes the primary typed-failure classification, canonical identity and known source origin.

Gotchas

The selected runtime must complete failure-payload cleanup before calling this operation.

Method NativeReport.fatal

pub effect<'env> fn fatal<'life0: 'env, 'life1: 'env, 'life2: 'env, 'env>(self: &'life0 mut NativeReport, reason: string<'life1>, source: string<'life2>) -> bool

Writes a distinct best-effort fatal classification, reason and known origin.

Gotchas

Returning from this formatter grants neither trap recovery nor structured cleanup.

Method NativeReport.frame

pub effect<'env> fn frame<'life0: 'env, 'life1: 'env, 'env>(self: &'life0 mut NativeReport, label: string<'life1>) -> bool

Appends an outward logical caller frame, excluding the already written origin.

Details

Exhausting the frame limit writes one truncation marker if the byte budget permits it, then marks the report incomplete. Later calls commit no additional output.

Method NativeReport.truncate

pub effect<'life0> fn truncate<'life0>(self: &'life0 mut NativeReport) -> bool

Marks missing diagnostic context with one bounded marker and stops later output.

Details

Use when source context storage cannot retain a frame or cause. An earlier output failure suppresses the marker; repeating this operation writes nothing further.

Method NativeReport.cause

pub effect<'env> fn cause<'life0: 'env, 'life1: 'env, 'life2: 'env, 'env>(self: &'life0 mut NativeReport, identity: string<'life1>, source: string<'life2>) -> bool

Appends a retained recovery cause after the primary failure and its logical callers.

Method NativeReport.succeeded

pub fn succeeded<'life0>(self: &'life0 NativeReport) -> bool

Reports whether every requested fragment was written within both configured limits.

On this page