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

Method unwrap_leaf

cranelift/bforest/src/node.rs:115–131  ·  view source on GitHub ↗

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

(&self)

Source from the content-addressed store, hash-verified

113
114 /// Unwrap a leaf node into two slices (keys, values) of the same length.
115 pub fn unwrap_leaf(&self) -> (&[F::Key], &[F::Value]) {
116 match *self {
117 Self::Leaf {
118 size,
119 ref keys,
120 ref vals,
121 } => {
122 let size = usize::from(size);
123 let keys = keys.borrow();
124 let vals = vals.borrow();
125 // TODO: We could probably use `get_unchecked()` here since `size` is always in
126 // range.
127 (&keys[0..size], &vals[0..size])
128 }
129 _ => panic!("Expected leaf node"),
130 }
131 }
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]) {

Callers 6

nextMethod · 0.80
prevMethod · 0.80
keyMethod · 0.80
valueMethod · 0.80
retainMethod · 0.80
elemMethod · 0.80

Calls 2

fromFunction · 0.85
borrowMethod · 0.45

Tested by

no test coverage detected