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

Method insert

cranelift/bforest/src/path.rs:264–274  ·  view source on GitHub ↗

Insert the key-value pair at the current position. The current position must be the correct insertion location for the key. This function does not check for duplicate keys. Use `find` or similar for that. Returns the new root node.

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

Source from the content-addressed store, hash-verified

262 /// This function does not check for duplicate keys. Use `find` or similar for that.
263 /// Returns the new root node.
264 pub fn insert(
265 &mut self,
266 key: F::Key,
267 value: F::Value,
268 pool: &mut NodePool<F>,
269 ) -> Result<Node, OutOfMemory> {
270 if !self.try_leaf_insert(key, value, pool) {
271 self.split_and_insert(key, value, pool)?;
272 }
273 Ok(self.node[0])
274 }
275
276 /// Try to insert `key, value` at the current position, but fail and return false if the leaf
277 /// node is full.

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
split_and_insertMethod · 0.80
try_leaf_insertMethod · 0.45

Tested by

no test coverage detected