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

Function line_starts

codegraph-kernel/src/cfnptr.rs:1159–1167  ·  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

1157}
1158
1159/// Line start offsets (byte offset of each line's first byte).
1160fn 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

Callers 1

scan_fileFunction · 0.70

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected