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

Method position_of

codegraph-kernel/src/ccpp/brace_scopes.rs:88–91  ·  view source on GitHub ↗

The 1-based line and the UTF-16 column of `offset`.

(src: &str, line_starts: &[usize], offset: usize)

Source from the content-addressed store, hash-verified

86
87 /// The 1-based line and the UTF-16 column of `offset`.
88 pub fn position_of(src: &str, line_starts: &[usize], offset: usize) -> (u32, u32) {
89 let row = line_starts.partition_point(|&s| s <= offset).saturating_sub(1);
90 (row as u32 + 1, util::col16(src, line_starts, row, offset))
91 }
92}
93
94fn is_blank(c: u8) -> bool {

Callers

nothing calls this directly

Calls 1

col16Function · 0.85

Tested by

no test coverage detected