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

Method try_insert

cranelift/bforest/src/map.rs:144–152  ·  view source on GitHub ↗

Like `insert` but returns an error on allocation failure.

(
        &mut self,
        key: K,
        value: V,
        forest: &mut MapForest<K, V>,
        comp: &C,
    )

Source from the content-addressed store, hash-verified

142
143 /// Like `insert` but returns an error on allocation failure.
144 pub fn try_insert<C: Comparator<K>>(
145 &mut self,
146 key: K,
147 value: V,
148 forest: &mut MapForest<K, V>,
149 comp: &C,
150 ) -> Result<Option<V>, OutOfMemory> {
151 self.cursor_mut(forest, comp).try_insert(key, value)
152 }
153
154 /// Remove `key` from the map and return the removed value for `key`, if any.
155 pub fn remove<C: Comparator<K>>(

Callers 1

insertMethod · 0.45

Calls 10

leafFunction · 0.85
OkFunction · 0.85
cursor_mutMethod · 0.80
alloc_nodeMethod · 0.80
set_root_nodeMethod · 0.80
expandMethod · 0.45
findMethod · 0.45
is_someMethod · 0.45
value_mutMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected