Line start offsets (byte offset of each line's first byte).
(s: &[u8])
| 1157 | } |
| 1158 | |
| 1159 | /// Line start offsets (byte offset of each line's first byte). |
| 1160 | fn line_starts(s: &[u8]) -> Vec<usize> { |
| 1161 | let mut out = vec![0usize]; |
| 1162 | for (i, &b) in s.iter().enumerate() { |
| 1163 | if b == b'\n' { |
| 1164 | out.push(i + 1); |
| 1165 | } |
| 1166 | } |
| 1167 | out |
| 1168 | } |
| 1169 | |
| 1170 | /// Run the full extraction sweep for one file. `raw` is the file text exactly |