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

Method try_leaf_insert

cranelift/bforest/src/path.rs:278–287  ·  view source on GitHub ↗

Try to insert `key, value` at the current position, but fail and return false if the leaf node is full.

(&self, key: F::Key, value: F::Value, pool: &mut NodePool<F>)

Source from the content-addressed store, hash-verified

276 /// Try to insert `key, value` at the current position, but fail and return false if the leaf
277 /// node is full.
278 fn try_leaf_insert(&self, key: F::Key, value: F::Value, pool: &mut NodePool<F>) -> bool {
279 let index = self.leaf_entry();
280
281 // The case `index == 0` should only ever happen when there are no earlier leaf nodes,
282 // otherwise we should have appended to the previous leaf node instead. This invariant
283 // means that we don't need to update keys stored in inner nodes here.
284 debug_assert!(index > 0 || self.at_first_entry());
285
286 pool[self.leaf_node()].try_leaf_insert(index, key, value)
287 }
288
289 /// Split the current leaf node and then insert `key, value`.
290 /// This should only be used if `try_leaf_insert()` fails.

Callers 2

insertMethod · 0.45
split_and_insertMethod · 0.45

Calls 2

leaf_entryMethod · 0.80
leaf_nodeMethod · 0.80

Tested by

no test coverage detected