pub fn spanned_error<T, M: Display>(
source: &str,
span: &Spanned<T>,
message: M,
) -> ReportExpand description
Create a [miette::Report] pointing at the source span of a
Spanned<T> value.
This bridges noyalib’s source-location tracking with miette’s rich terminal diagnostic output, letting users validate deserialized config and report errors that point back to the exact YAML source.
§Examples
use noyalib::{from_str, Spanned, diagnostic::spanned_error};
#[derive(serde::Deserialize)]
struct Cfg { port: Spanned<u16> }
let yaml = "port: 80\n";
let cfg: Cfg = from_str(yaml).unwrap();
let report = spanned_error(yaml, &cfg.port, "too low");
assert!(format!("{report}").contains("too low"));