@@ -132,7 +132,7 @@ impl<K, V> Root<K, V> {
132
132
}
133
133
134
134
impl < K , V > NodeRef < marker:: Owned , K , V , marker:: Leaf > {
135
- fn new_leaf ( ) -> Self {
135
+ pub fn new_leaf ( ) -> Self {
136
136
Self :: from_new_leaf ( Box :: new ( unsafe { LeafNode :: new ( ) } ) )
137
137
}
138
138
@@ -142,7 +142,7 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::Leaf> {
142
142
}
143
143
144
144
impl < K , V > NodeRef < marker:: Owned , K , V , marker:: Internal > {
145
- fn new_internal ( child : Root < K , V > ) -> Self {
145
+ pub fn new_internal ( child : Root < K , V > ) -> Self {
146
146
let mut new_node = Box :: new ( unsafe { InternalNode :: new ( ) } ) ;
147
147
new_node. edges [ 0 ] . write ( child. node ) ;
148
148
NodeRef :: from_new_internal ( new_node, child. height + 1 )
@@ -1461,45 +1461,22 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
1461
1461
}
1462
1462
}
1463
1463
1464
- impl < BorrowType , K , V > NodeRef < BorrowType , K , V , marker:: Leaf > {
1465
- /// Removes any static information asserting that this node is a `Leaf` node.
1466
- pub fn forget_type ( self ) -> NodeRef < BorrowType , K , V , marker:: LeafOrInternal > {
1467
- NodeRef { height : self . height , node : self . node , _marker : PhantomData }
1468
- }
1469
- }
1470
-
1471
- impl < BorrowType , K , V > NodeRef < BorrowType , K , V , marker:: Internal > {
1472
- /// Removes any static information asserting that this node is an `Internal` node.
1464
+ impl < BorrowType , K , V , Type > NodeRef < BorrowType , K , V , Type > {
1465
+ /// Removes any static information asserting that this node is a `Leaf` or `Internal` node.
1473
1466
pub fn forget_type ( self ) -> NodeRef < BorrowType , K , V , marker:: LeafOrInternal > {
1474
1467
NodeRef { height : self . height , node : self . node , _marker : PhantomData }
1475
1468
}
1476
1469
}
1477
1470
1478
- impl < BorrowType , K , V > Handle < NodeRef < BorrowType , K , V , marker:: Leaf > , marker:: Edge > {
1479
- pub fn forget_node_type (
1480
- self ,
1481
- ) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: Edge > {
1482
- unsafe { Handle :: new_edge ( self . node . forget_type ( ) , self . idx ) }
1483
- }
1484
- }
1485
-
1486
- impl < BorrowType , K , V > Handle < NodeRef < BorrowType , K , V , marker:: Internal > , marker:: Edge > {
1471
+ impl < BorrowType , K , V , NodeType > Handle < NodeRef < BorrowType , K , V , NodeType > , marker:: Edge > {
1487
1472
pub fn forget_node_type (
1488
1473
self ,
1489
1474
) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: Edge > {
1490
1475
unsafe { Handle :: new_edge ( self . node . forget_type ( ) , self . idx ) }
1491
1476
}
1492
1477
}
1493
1478
1494
- impl < BorrowType , K , V > Handle < NodeRef < BorrowType , K , V , marker:: Leaf > , marker:: KV > {
1495
- pub fn forget_node_type (
1496
- self ,
1497
- ) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: KV > {
1498
- unsafe { Handle :: new_kv ( self . node . forget_type ( ) , self . idx ) }
1499
- }
1500
- }
1501
-
1502
- impl < BorrowType , K , V > Handle < NodeRef < BorrowType , K , V , marker:: Internal > , marker:: KV > {
1479
+ impl < BorrowType , K , V , NodeType > Handle < NodeRef < BorrowType , K , V , NodeType > , marker:: KV > {
1503
1480
pub fn forget_node_type (
1504
1481
self ,
1505
1482
) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: KV > {
0 commit comments