MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / line_starts

Function line_starts

codegraph-kernel/src/cfnptr.rs:1169–1177  ·  view source on GitHub ↗

Line start offsets (byte offset of each line's first byte).

(s: &[u8])

Source from the content-addressed store, hash-verified

1167}
1168
1169/// Line start offsets (byte offset of each line's first byte).
1170fn line_starts(s: &[u8]) -> Vec<usize> {
1171 let mut out = vec![0usize];
1172 for (i, &b) in s.iter().enumerate() {
1173 if b == b'\n' {
1174 out.push(i + 1);
1175 }
1176 }
1177 out
1178}
1179
1180/// Run the full extraction sweep for one file. `raw` is the file text exactly

Callers 1

scan_fileFunction · 0.70

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected