compute_line_starts

Function compute_line_starts 

Source
pub fn compute_line_starts(content: &str) -> Vec<usize>
Expand description

Compute the byte offset of the start of each line (1-indexed).

Returns a vector where line_starts[0] is always 0 (start of line 1), line_starts[1] is the byte offset of line 2, etc. An extra entry at the end equals content.len() for convenience.