@@ -213,7 +213,8 @@ unsafe impl<K: Send, V: Send, Type> Send for NodeRef<marker::Owned, K, V, Type>
213213unsafe impl < K : Send , V : Send , Type > Send for NodeRef < marker:: Dying , K , V , Type > { }
214214
215215impl < 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 {
217218 Self :: from_new_leaf ( LeafNode :: new ( ) )
218219 }
219220
@@ -223,7 +224,8 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::Leaf> {
223224}
224225
225226impl < 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 {
227229 let mut new_node = unsafe { InternalNode :: new ( ) } ;
228230 new_node. edges [ 0 ] . write ( child. node ) ;
229231 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> {
651653 }
652654}
653655
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.
663658 pub fn forget_type ( self ) -> NodeRef < BorrowType , K , V , marker:: LeafOrInternal > {
664659 NodeRef { height : self . height , node : self . node , _marker : PhantomData }
665660 }
@@ -1505,31 +1500,15 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
15051500 }
15061501}
15071502
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 > {
15171504 pub fn forget_node_type (
15181505 self ,
15191506 ) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: Edge > {
15201507 unsafe { Handle :: new_edge ( self . node . forget_type ( ) , self . idx ) }
15211508 }
15221509}
15231510
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 > {
15331512 pub fn forget_node_type (
15341513 self ,
15351514 ) -> Handle < NodeRef < BorrowType , K , V , marker:: LeafOrInternal > , marker:: KV > {
0 commit comments