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

Method spare_before

codegraph-kernel/src/textutil.rs:146–151  ·  view source on GitHub ↗

The bytes before `pos` that count for no UTF-16 unit.

(&self, pos: usize)

Source from the content-addressed store, hash-verified

144impl LineStarts {
145 /// The bytes before `pos` that count for no UTF-16 unit.
146 fn spare_before(&self, pos: usize) -> usize {
147 match self.wide.partition_point(|&(at, _)| at < pos) {
148 0 => 0,
149 n => self.wide[n - 1].1,
150 }
151 }
152}
153
154impl std::ops::Deref for LineStarts {

Callers 1

col16Function · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected