Unwrap a mutable leaf node into two slices (keys, values) of the same length.
(&mut self)
| 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. |