MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / next

Method next

cranelift/bforest/src/path.rs:108–126  ·  view source on GitHub ↗

Move this path to the next key-value pair and return it.

(&mut self, pool: &NodePool<F>)

Source from the content-addressed store, hash-verified

106
107 /// Move this path to the next key-value pair and return it.
108 pub fn next(&mut self, pool: &NodePool<F>) -> Option<(F::Key, F::Value)> {
109 match self.leaf_pos() {
110 None => return None,
111 Some((node, entry)) => {
112 let (keys, vals) = pool[node].unwrap_leaf();
113 if entry + 1 < keys.len() {
114 self.entry[self.size - 1] += 1;
115 return Some((keys[entry + 1], vals[entry + 1]));
116 }
117 }
118 }
119
120 // The current leaf node is exhausted. Move to the next one.
121 let leaf_level = self.size - 1;
122 self.next_node(leaf_level, pool).map(|node| {
123 let (keys, vals) = pool[node].unwrap_leaf();
124 (keys[0], vals[0])
125 })
126 }
127
128 /// Move this path to the previous key-value pair and return it.
129 ///

Callers

nothing calls this directly

Calls 5

leaf_posMethod · 0.80
unwrap_leafMethod · 0.80
next_nodeMethod · 0.80
lenMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected