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

Method prev_leaf

cranelift/bforest/src/path.rs:195–202  ·  view source on GitHub ↗

Move the path to the last entry of the previous leaf node, if one exists. Returns the new leaf node if it exists. Leave the path unchanged and returns `None` if we are already at the first leaf node.

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

Source from the content-addressed store, hash-verified

193 ///
194 /// Leave the path unchanged and returns `None` if we are already at the first leaf node.
195 fn prev_leaf(&mut self, pool: &NodePool<F>) -> Option<Node> {
196 self.left_sibling_branch_level(self.size - 1).map(|bl| {
197 let entry = self.entry[bl] - 1;
198 self.entry[bl] = entry;
199 let (_, bnodes) = pool[self.node[bl]].unwrap_inner();
200 self.goto_subtree_last(bl + 1, bnodes[usize::from(entry)], pool)
201 })
202 }
203
204 /// Move this path to the last position for the sub-tree at `level, root`.
205 fn goto_subtree_last(&mut self, level: usize, root: Node, pool: &NodePool<F>) -> Node {

Callers 1

prevMethod · 0.80

Calls 5

fromFunction · 0.85
unwrap_innerMethod · 0.80
goto_subtree_lastMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected