MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / next

Method next

rust/src/iteration.rs:227–251  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

225 type Item = (&'a K, &'a V);
226
227 fn next(&mut self) -> Option<Self::Item> {
228 // STREAMLINED CONTROL FLOW: Eliminate finished flag, reduce branching
229 //
230 // Key optimizations:
231 // 1. Use current_leaf_ref.is_none() as terminal state (no finished flag)
232 // 2. Direct flow with fewer nested conditions
233 // 3. Simplified advance_to_next_leaf_direct() with bool return
234 // 4. Single exit point pattern
235
236 loop {
237 // Direct access - if no leaf, we're done (terminal state)
238 let leaf = self.current_leaf_ref?;
239
240 // Try current leaf first
241 if let Some(item) = self.try_get_next_item(leaf) {
242 return Some(item);
243 }
244
245 // Advance to next leaf - if false, we're done
246 if !self.advance_to_next_leaf_direct() {
247 return None;
248 }
249 // Continue with next leaf
250 }
251 }
252}
253
254// ============================================================================

Callers 8

firstMethod · 0.80
mainFunction · 0.80
test_creation_overheadFunction · 0.80
test_single_operationsFunction · 0.80

Calls 6

try_get_next_itemMethod · 0.80
keys_lenMethod · 0.80
get_keyMethod · 0.80
get_valueMethod · 0.80
get_leaf_uncheckedMethod · 0.80