[][src]Module asciifile::span

Input File Ranges

A Span is equivalent to a slice of the input file annotated with line and column of start and end indices.

A Span is immutable by design. Mutations will always return a new instance of a Span.

A Span is a guranteed valid text range of the input file. This means actions like as_str() cannot fail with out of bounds indices on run-time.

The range defined by the start and end position of a Span is inclusive on the both sides (lower and upper bound). As a result, as_str() will contain the character pointed at by the start position and the character pointed to by the end position. Beware that this is not equivalent to rust's behaviour on slices, which will not contain the upper bound if low..high is used. By including the upper bound in the Span, we do not have to generate a fake EOF-Position/character beyond the real end of input to create a Span that contains the last character of the input file. This also means that you cannot create an empty Span.

Analog to Position, rows and columns are zero indexed. This means that the first character of a file is positioned at column 0 in row 0.

Structs

LineIterator

An Iterator over the lines of a Span.

LineNumberIterator

Iterator adapter that adds line numbers to a LineIterator

Span