Skip to main content

Module span

Module span 

Source
Expand description

Source location tracking for error reporting.

Provides types for tracking positions within source code:

  • BytePos: A byte offset into source text
  • Span: A range of bytes representing a source region
  • Spanned<T>: A value paired with its source location

Structs§

BytePos
A byte position in source code.
Span
A span representing a range of source code.
Spanned
A value with an associated source span.

Functions§

get_line
Returns the line containing a position.
line_col
Computes line and column from a byte position.
line_number
Returns the line number (1-indexed) for a position.