Skip to main content

Module diagnostic

Module diagnostic 

Source
Expand description

Framework-neutral diagnostics and optional rendering bridges. Framework-neutral structured diagnostics and optional miette bridges.

Diagnostic is the canonical machine-readable representation used by terminal renderers, editor protocols, and service integrations. Optional adapters translate that payload into ecosystem-specific formats instead of maintaining separate error-code, help, and label tables.

§Examples

use noyalib::{DiagnosticCode, Value, from_str};

let err = from_str::<Value>("key: [unclosed").unwrap_err();
let diagnostic = err.diagnostic();
assert_eq!(diagnostic.code(), DiagnosticCode::Parse);
assert!(!diagnostic.labels().is_empty());

Structs§

Diagnostic
Framework-neutral diagnostic payload derived from an error or validator.
DiagnosticLabel
A message attached to one source span.
SourceSpan
A half-open byte range in the original UTF-8 source.

Enums§

DiagnosticCode
Stable machine-readable code for a noyalib diagnostic.
DiagnosticSeverity
Protocol-neutral diagnostic severity.

Functions§

spanned_error
Create a [miette::Report] pointing at the source span of a Spanned<T> value.
spanned_error_with_context
Create a [miette::Report] pointing at a primary span with additional context from a secondary span.