Expand description
Zero-copy YAML values that borrow from the input.
[ariadne] adapter — render crate::Error as an
ariadne::Report with the offending byte range labelled.
Behind the ariadne Cargo feature.
[ariadne] adapter for crate::Error.
Renders a noyalib error as an [ariadne::Report] with the
offending byte range labelled, the line/column annotated, and
the surrounding source available for terminal-friendly display.
Pairs with the existing [miette::Diagnostic] impl for users
who prefer ariadne’s rendering.
§Examples
use noyalib::{from_str, Value};
use noyalib::ariadne_adapter::error_to_ariadne_report;
use ariadne::Source;
let source = "a: [unclosed";
let err = from_str::<Value>(source).unwrap_err();
let report = error_to_ariadne_report(&err, "input.yaml", source);
let mut buf: Vec<u8> = Vec::new();
report.write(("input.yaml", Source::from(source)), &mut buf).unwrap();
assert!(!buf.is_empty());Functions§
- error_
to_ ariadne_ report - Convert a noyalib
Errorinto an [ariadne::Report].