MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / next_range

Method next_range

src/data/parse/json.rs:220–237  ·  view source on GitHub ↗
(&self, start: Self::Pos, counts: u32)

Source from the content-addressed store, hash-verified

218 }
219
220 fn next_range(&self, start: Self::Pos, counts: u32) -> Result<(&str, Self::Pos), Self::Err>
221 {
222 let startidx = start.idx() as usize;
223 let range = startidx..startidx + counts as usize;
224 self.get(range)
225 .map(|s|
226 {
227 let mut pos = start;
228 for c in s.chars()
229 {
230 pos = pos.next(c);
231 }
232
233 (s, pos)
234 })
235
236 .ok_or_else(|| self.err_at(start, "[ERR] OUT OF BOUNDS"))
237 }
238
239
240 fn err_at(&self, pos: Self::Pos, cause: &'static str) -> Self::Err

Callers

nothing calls this directly

Calls 4

err_atMethod · 0.80
idxMethod · 0.45
mapMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected