pub fn clamped_span(start: usize, end: usize, source_len: usize) -> SourceSpanExpand description
Helper: clamp a span end so it never lands before its start.
Exposed for crate::Spanned integrations that compute their
own byte range and want to plug straight into a miette source
span without re-implementing the clamp.
ยงExamples
use noyalib::validated_miette::clamped_span;
let span: miette::SourceSpan = clamped_span(10, 20, 100);
assert_eq!(span.offset(), 10);
assert_eq!(span.len(), 10);