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

Method first

cranelift/bforest/src/path.rs:92–105  ·  view source on GitHub ↗

Move path to the first entry of the tree starting at `root` and return it.

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

Source from the content-addressed store, hash-verified

90
91 /// Move path to the first entry of the tree starting at `root` and return it.
92 pub fn first(&mut self, root: Node, pool: &NodePool<F>) -> (F::Key, F::Value) {
93 let mut node = root;
94 for level in 0.. {
95 self.size = level + 1;
96 self.node[level] = node;
97 self.entry[level] = 0;
98 match pool[node] {
99 NodeData::Inner { tree, .. } => node = tree[0],
100 NodeData::Leaf { keys, vals, .. } => return (keys.borrow()[0], vals.borrow()[0]),
101 NodeData::Free { .. } => panic!("Free {node} reached from {root}"),
102 }
103 }
104 unreachable!();
105 }
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)> {

Callers 6

retainMethod · 0.45
goto_firstMethod · 0.45
nextMethod · 0.45
retainMethod · 0.45
goto_firstMethod · 0.45
nextMethod · 0.45

Calls 1

borrowMethod · 0.45

Tested by

no test coverage detected