7 releases

Uses new Rust 2024

new 0.14.0 May 12, 2026
0.13.3 May 3, 2026
0.13.0-rc1 Apr 30, 2026
0.12.2 Apr 8, 2026

#192 in Parser tooling


Used in 3 crates (2 directly)

MIT/Apache

10KB
117 lines

Byte-oriented line/column indexing helpers.

This crate has one responsibility: map byte offsets to (line, column) and back using cached line starts.


perl-line-index

A tiny microcrate that provides a byte-oriented line index used by incremental parsing paths.

API

  • LineIndex::new(&str) builds a line-start cache.
  • LineIndex::byte_to_position(usize) maps byte offset to (line, column).
  • LineIndex::position_to_byte(line, column) maps back to byte offsets.
  • LineIndex::position_to_byte_checked(line, column) returns None if the column crosses the addressed line's byte boundary.

No runtime deps