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

Method unwrap_leaf_mut

cranelift/bforest/src/node.rs:134–150  ·  view source on GitHub ↗

Unwrap a mutable leaf node into two slices (keys, values) of the same length.

(&mut self)

Source from the content-addressed store, hash-verified

132
133 /// Unwrap a mutable leaf node into two slices (keys, values) of the same length.
134 pub fn unwrap_leaf_mut(&mut self) -> (&mut [F::Key], &mut [F::Value]) {
135 match *self {
136 Self::Leaf {
137 size,
138 ref mut keys,
139 ref mut vals,
140 } => {
141 let size = usize::from(size);
142 let keys = keys.borrow_mut();
143 let vals = vals.borrow_mut();
144 // TODO: We could probably use `get_unchecked_mut()` here since `size` is always in
145 // range.
146 (&mut keys[0..size], &mut vals[0..size])
147 }
148 _ => panic!("Expected leaf node"),
149 }
150 }
151
152 /// Get the critical key for a leaf node.
153 /// This is simply the first key.

Callers 3

value_mutMethod · 0.80
retainMethod · 0.80
value_mutMethod · 0.80

Calls 1

fromFunction · 0.85

Tested by

no test coverage detected