fn clamp(source: &str, range: &Range<usize>) -> Range<usize> ⓘExpand description
Clamp range to [0, source.len()] and snap its endpoints outward to the
enclosing char boundaries (start down, end up).
annotate-snippets slices source at these byte offsets and panics on an
offset that is out of bounds or falls inside a multi-byte char.