@@ -7,9 +7,9 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
77 /// sibling. If successful but at the cost of shrinking the parent node,
88 /// returns that shrunk parent node. Returns an `Err` if the node is
99 /// an empty root.
10- fn fix_node_through_parent < A : Allocator > (
10+ fn fix_node_through_parent < A : Allocator + Clone > (
1111 self ,
12- alloc : & A ,
12+ alloc : A ,
1313 ) -> Result < Option < NodeRef < marker:: Mut < ' a > , K , V , marker:: Internal > > , Self > {
1414 let len = self . len ( ) ;
1515 if len >= MIN_LEN {
@@ -54,9 +54,9 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
5454 ///
5555 /// This method does not expect ancestors to already be underfull upon entry
5656 /// and panics if it encounters an empty ancestor.
57- pub fn fix_node_and_affected_ancestors < A : Allocator > ( mut self , alloc : & A ) -> bool {
57+ pub fn fix_node_and_affected_ancestors < A : Allocator + Clone > ( mut self , alloc : A ) -> bool {
5858 loop {
59- match self . fix_node_through_parent ( alloc) {
59+ match self . fix_node_through_parent ( alloc. clone ( ) ) {
6060 Ok ( Some ( parent) ) => self = parent. forget_type ( ) ,
6161 Ok ( None ) => return true ,
6262 Err ( _) => return false ,
@@ -67,28 +67,28 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
6767
6868impl < K , V > Root < K , V > {
6969 /// Removes empty levels on the top, but keeps an empty leaf if the entire tree is empty.
70- pub fn fix_top < A : Allocator > ( & mut self , alloc : & A ) {
70+ pub fn fix_top < A : Allocator + Clone > ( & mut self , alloc : A ) {
7171 while self . height ( ) > 0 && self . len ( ) == 0 {
72- self . pop_internal_level ( alloc) ;
72+ self . pop_internal_level ( alloc. clone ( ) ) ;
7373 }
7474 }
7575
7676 /// Stocks up or merge away any underfull nodes on the right border of the
7777 /// tree. The other nodes, those that are not the root nor a rightmost edge,
7878 /// must already have at least MIN_LEN elements.
79- pub fn fix_right_border < A : Allocator > ( & mut self , alloc : & A ) {
80- self . fix_top ( alloc) ;
79+ pub fn fix_right_border < A : Allocator + Clone > ( & mut self , alloc : A ) {
80+ self . fix_top ( alloc. clone ( ) ) ;
8181 if self . len ( ) > 0 {
82- self . borrow_mut ( ) . last_kv ( ) . fix_right_border_of_right_edge ( alloc) ;
82+ self . borrow_mut ( ) . last_kv ( ) . fix_right_border_of_right_edge ( alloc. clone ( ) ) ;
8383 self . fix_top ( alloc) ;
8484 }
8585 }
8686
8787 /// The symmetric clone of `fix_right_border`.
88- pub fn fix_left_border < A : Allocator > ( & mut self , alloc : & A ) {
89- self . fix_top ( alloc) ;
88+ pub fn fix_left_border < A : Allocator + Clone > ( & mut self , alloc : A ) {
89+ self . fix_top ( alloc. clone ( ) ) ;
9090 if self . len ( ) > 0 {
91- self . borrow_mut ( ) . first_kv ( ) . fix_left_border_of_left_edge ( alloc) ;
91+ self . borrow_mut ( ) . first_kv ( ) . fix_left_border_of_left_edge ( alloc. clone ( ) ) ;
9292 self . fix_top ( alloc) ;
9393 }
9494 }
@@ -115,16 +115,16 @@ impl<K, V> Root<K, V> {
115115}
116116
117117impl < ' a , K : ' a , V : ' a > Handle < NodeRef < marker:: Mut < ' a > , K , V , marker:: LeafOrInternal > , marker:: KV > {
118- fn fix_left_border_of_left_edge < A : Allocator > ( mut self , alloc : & A ) {
118+ fn fix_left_border_of_left_edge < A : Allocator + Clone > ( mut self , alloc : A ) {
119119 while let Internal ( internal_kv) = self . force ( ) {
120- self = internal_kv. fix_left_child ( alloc) . first_kv ( ) ;
120+ self = internal_kv. fix_left_child ( alloc. clone ( ) ) . first_kv ( ) ;
121121 debug_assert ! ( self . reborrow( ) . into_node( ) . len( ) > MIN_LEN ) ;
122122 }
123123 }
124124
125- fn fix_right_border_of_right_edge < A : Allocator > ( mut self , alloc : & A ) {
125+ fn fix_right_border_of_right_edge < A : Allocator + Clone > ( mut self , alloc : A ) {
126126 while let Internal ( internal_kv) = self . force ( ) {
127- self = internal_kv. fix_right_child ( alloc) . last_kv ( ) ;
127+ self = internal_kv. fix_right_child ( alloc. clone ( ) ) . last_kv ( ) ;
128128 debug_assert ! ( self . reborrow( ) . into_node( ) . len( ) > MIN_LEN ) ;
129129 }
130130 }
@@ -135,9 +135,9 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
135135 /// provisions an extra element to allow merging its children in turn
136136 /// without becoming underfull.
137137 /// Returns the left child.
138- fn fix_left_child < A : Allocator > (
138+ fn fix_left_child < A : Allocator + Clone > (
139139 self ,
140- alloc : & A ,
140+ alloc : A ,
141141 ) -> NodeRef < marker:: Mut < ' a > , K , V , marker:: LeafOrInternal > {
142142 let mut internal_kv = self . consider_for_balancing ( ) ;
143143 let left_len = internal_kv. left_child_len ( ) ;
@@ -158,9 +158,9 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
158158 /// provisions an extra element to allow merging its children in turn
159159 /// without becoming underfull.
160160 /// Returns wherever the right child ended up.
161- fn fix_right_child < A : Allocator > (
161+ fn fix_right_child < A : Allocator + Clone > (
162162 self ,
163- alloc : & A ,
163+ alloc : A ,
164164 ) -> NodeRef < marker:: Mut < ' a > , K , V , marker:: LeafOrInternal > {
165165 let mut internal_kv = self . consider_for_balancing ( ) ;
166166 let right_len = internal_kv. right_child_len ( ) ;
0 commit comments