@@ -1018,6 +1018,16 @@ impl<'a, K: 'a, V: 'a, NodeType> Handle<NodeRef<marker::Immut<'a>, K, V, NodeTyp
10181018}
10191019
10201020impl < ' a , K : ' a , V : ' a , NodeType > Handle < NodeRef < marker:: Mut < ' a > , K , V , NodeType > , marker:: KV > {
1021+ pub fn into_key_mut ( self ) -> & ' a mut K {
1022+ let keys = self . node . into_key_slice_mut ( ) ;
1023+ unsafe { keys. get_unchecked_mut ( self . idx ) }
1024+ }
1025+
1026+ pub fn into_val_mut ( self ) -> & ' a mut V {
1027+ let vals = self . node . into_val_slice_mut ( ) ;
1028+ unsafe { vals. get_unchecked_mut ( self . idx ) }
1029+ }
1030+
10211031 pub fn into_kv_mut ( self ) -> ( & ' a mut K , & ' a mut V ) {
10221032 unsafe {
10231033 let ( keys, vals) = self . node . into_slices_mut ( ) ;
@@ -1216,8 +1226,8 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
12161226 unsafe {
12171227 let ( k, v, edge) = self . reborrow_mut ( ) . left_edge ( ) . descend ( ) . pop ( ) ;
12181228
1219- let k = mem:: replace ( self . reborrow_mut ( ) . into_kv_mut ( ) . 0 , k) ;
1220- let v = mem:: replace ( self . reborrow_mut ( ) . into_kv_mut ( ) . 1 , v) ;
1229+ let k = mem:: replace ( self . kv_mut ( ) . 0 , k) ;
1230+ let v = mem:: replace ( self . kv_mut ( ) . 1 , v) ;
12211231
12221232 match self . reborrow_mut ( ) . right_edge ( ) . descend ( ) . force ( ) {
12231233 ForceResult :: Leaf ( mut leaf) => leaf. push_front ( k, v) ,
@@ -1233,8 +1243,8 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
12331243 unsafe {
12341244 let ( k, v, edge) = self . reborrow_mut ( ) . right_edge ( ) . descend ( ) . pop_front ( ) ;
12351245
1236- let k = mem:: replace ( self . reborrow_mut ( ) . into_kv_mut ( ) . 0 , k) ;
1237- let v = mem:: replace ( self . reborrow_mut ( ) . into_kv_mut ( ) . 1 , v) ;
1246+ let k = mem:: replace ( self . kv_mut ( ) . 0 , k) ;
1247+ let v = mem:: replace ( self . kv_mut ( ) . 1 , v) ;
12381248
12391249 match self . reborrow_mut ( ) . left_edge ( ) . descend ( ) . force ( ) {
12401250 ForceResult :: Leaf ( mut leaf) => leaf. push ( k, v) ,
@@ -1262,7 +1272,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
12621272 let left_kv = left_node. reborrow_mut ( ) . into_kv_pointers_mut ( ) ;
12631273 let right_kv = right_node. reborrow_mut ( ) . into_kv_pointers_mut ( ) ;
12641274 let parent_kv = {
1265- let kv = self . reborrow_mut ( ) . into_kv_mut ( ) ;
1275+ let kv = self . kv_mut ( ) ;
12661276 ( kv. 0 as * mut K , kv. 1 as * mut V )
12671277 } ;
12681278
@@ -1319,7 +1329,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
13191329 let left_kv = left_node. reborrow_mut ( ) . into_kv_pointers_mut ( ) ;
13201330 let right_kv = right_node. reborrow_mut ( ) . into_kv_pointers_mut ( ) ;
13211331 let parent_kv = {
1322- let kv = self . reborrow_mut ( ) . into_kv_mut ( ) ;
1332+ let kv = self . kv_mut ( ) ;
13231333 ( kv. 0 as * mut K , kv. 1 as * mut V )
13241334 } ;
13251335
0 commit comments