@@ -213,7 +213,8 @@ unsafe impl<K: Send, V: Send, Type> Send for NodeRef<marker::Owned, K, V, Type>
213
213
unsafe impl < K : Send , V : Send , Type > Send for NodeRef < marker:: Dying , K , V , Type > { }
214
214
215
215
impl < K , V > NodeRef < marker:: Owned , K , V , marker:: Leaf > {
216
- fn new_leaf ( ) -> Self {
216
+ /// Returns a new owned leaf node, that is initially empty.
217
+ pub fn new_leaf ( ) -> Self {
217
218
Self :: from_new_leaf ( LeafNode :: new ( ) )
218
219
}
219
220
@@ -223,7 +224,8 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::Leaf> {
223
224
}
224
225
225
226
impl < K , V > NodeRef < marker:: Owned , K , V , marker:: Internal > {
226
- fn new_internal ( child : Root < K , V > ) -> Self {
227
+ /// Returns a new owned internal node, that initially has no elements and one child.
228
+ pub fn new_internal ( child : Root < K , V > ) -> Self {
227
229
let mut new_node = unsafe { InternalNode :: new ( ) } ;
228
230
new_node. edges [ 0 ] . write ( child. node ) ;
229
231
unsafe { NodeRef :: from_new_internal ( new_node, child. height + 1 ) }
@@ -651,15 +653,8 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
651
653
}
652
654
}
653
655
654
- impl < BorrowType , K , V > NodeRef < BorrowType , K , V , marker:: Leaf > {
655
- /// Removes any static information asserting that this node is a `Leaf` node.
656
- pub fn forget_type ( self ) -> NodeRef < BorrowType , K , V , marker:: LeafOrInternal > {
657
- NodeRef { height : self . height , node : self . node , _marker : PhantomData }
658
- }
659
- }
660
-
661
- impl < BorrowType , K , V > NodeRef < BorrowType , K , V , marker:: Internal > {
662
- /// Removes any static information asserting that this node is an `Internal` node.
656
+ impl < BorrowType , K , V , NodeType > NodeRef < BorrowType , K , V , NodeType > {
657
+ /// Removes any static information asserting that this node is a `Leaf` or `Internal` node.
663
658
pub fn forget_type ( self ) -> NodeRef < BorrowType , K , V , marker:: LeafOrInternal > {
664
659
NodeRef { height : self . height , node : self . node , _marker : PhantomData }
665
660
}
@@ -1505,31 +1500,15 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
1505
1500
}
1506
1501
}
1507
1502
1508
- impl < BorrowType , K , V > Handle < NodeRef < BorrowType , K , V , marker:: Leaf > , marker:: Edge > {
1509
- pub fn forget_node_type (
1510
- self ,
1511
- ) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: Edge > {
1512
- unsafe { Handle :: new_edge ( self . node . forget_type ( ) , self . idx ) }
1513
- }
1514
- }
1515
-
1516
- impl < BorrowType , K , V > Handle < NodeRef < BorrowType , K , V , marker:: Internal > , marker:: Edge > {
1503
+ impl < BorrowType , K , V , NodeType > Handle < NodeRef < BorrowType , K , V , NodeType > , marker:: Edge > {
1517
1504
pub fn forget_node_type (
1518
1505
self ,
1519
1506
) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: Edge > {
1520
1507
unsafe { Handle :: new_edge ( self . node . forget_type ( ) , self . idx ) }
1521
1508
}
1522
1509
}
1523
1510
1524
- impl < BorrowType , K , V > Handle < NodeRef < BorrowType , K , V , marker:: Leaf > , marker:: KV > {
1525
- pub fn forget_node_type (
1526
- self ,
1527
- ) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: KV > {
1528
- unsafe { Handle :: new_kv ( self . node . forget_type ( ) , self . idx ) }
1529
- }
1530
- }
1531
-
1532
- impl < BorrowType , K , V > Handle < NodeRef < BorrowType , K , V , marker:: Internal > , marker:: KV > {
1511
+ impl < BorrowType , K , V , NodeType > Handle < NodeRef < BorrowType , K , V , NodeType > , marker:: KV > {
1533
1512
pub fn forget_node_type (
1534
1513
self ,
1535
1514
) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: KV > {
0 commit comments