Skip to main content

Module span

Module span 

Source
Expand description

Source locations: byte-offset Spans and their LineIndex translation into human-readable line/column LinePositions.

Structsยง

LineIndex
A precomputed map from byte offsets to line/column positions for one source string. Build it once with LineIndex::new, then query repeatedly.
LinePosition
A 1-based line and column, derived from a byte offset by LineIndex.
Span
A half-open byte range start..end into the original source string. These are absolute UTF-8 byte offsets from the start of the document (not line/column); use LineIndex to translate an offset into a line and column.