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

Method innermost

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

The innermost interval holding `offset`: the last interval opening before `offset` or one of the intervals around that one.

(&self, offset: usize)

Source from the content-addressed store, hash-verified

56 /// The innermost interval holding `offset`: the last interval opening
57 /// before `offset` or one of the intervals around that one.
58 fn innermost(&self, offset: usize) -> Option<usize> {
59 let count = self.opens.partition_point(|&o| o < offset);
60 let mut k = if count == 0 { None } else { Some(count - 1) };
61 while let Some(i) = k {
62 if self.closes[i] > offset {
63 break;
64 }
65 k = self.parents[i];
66 }
67 k
68 }
69}
70
71pub struct BraceScopes {

Callers 2

addMethod · 0.45
atMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected