@@ -83,11 +83,15 @@ pub(super) struct ParBuckets<'a, K, V> {
83
83
84
84
impl < ' a , K , V > ParBuckets < ' a , K , V > {
85
85
pub ( super ) fn new ( entries : & ' a VecDeque < Bucket < K , V > > ) -> Self {
86
- Self :: from_slices ( entries. as_slices ( ) )
86
+ let ( head, tail) = entries. as_slices ( ) ;
87
+ Self { head, tail }
87
88
}
88
89
89
- pub ( super ) fn from_slices ( ( head, tail) : ( & ' a [ Bucket < K , V > ] , & ' a [ Bucket < K , V > ] ) ) -> Self {
90
- Self { head, tail }
90
+ pub ( super ) fn from_slice ( slice : & ' a [ Bucket < K , V > ] ) -> Self {
91
+ Self {
92
+ head : slice,
93
+ tail : & [ ] ,
94
+ }
91
95
}
92
96
93
97
pub ( super ) fn iter ( & self ) -> impl Iterator < Item = & Bucket < K , V > > {
@@ -119,7 +123,7 @@ impl<'a, K: Sync, V: Sync> ParallelIterator for ParBuckets<'a, K, V> {
119
123
}
120
124
}
121
125
122
- impl < ' a , K : Sync , V : Sync > IndexedParallelIterator for ParBuckets < ' a , K , V > {
126
+ impl < K : Sync , V : Sync > IndexedParallelIterator for ParBuckets < ' _ , K , V > {
123
127
fn drive < C > ( self , consumer : C ) -> C :: Result
124
128
where
125
129
C : Consumer < Self :: Item > ,
@@ -167,7 +171,7 @@ where
167
171
168
172
fn into_par_iter ( self ) -> Self :: Iter {
169
173
ParIter {
170
- entries : ParBuckets :: from_slices ( ( & self . entries , & [ ] ) ) ,
174
+ entries : ParBuckets :: from_slice ( & self . entries ) ,
171
175
}
172
176
}
173
177
}
@@ -215,11 +219,15 @@ struct ParBucketsMut<'a, K, V> {
215
219
216
220
impl < ' a , K , V > ParBucketsMut < ' a , K , V > {
217
221
fn new ( entries : & ' a mut VecDeque < Bucket < K , V > > ) -> Self {
218
- Self :: from_mut_slices ( entries. as_mut_slices ( ) )
222
+ let ( head, tail) = entries. as_mut_slices ( ) ;
223
+ Self { head, tail }
219
224
}
220
225
221
- fn from_mut_slices ( ( head, tail) : ( & ' a mut [ Bucket < K , V > ] , & ' a mut [ Bucket < K , V > ] ) ) -> Self {
222
- Self { head, tail }
226
+ fn from_mut_slice ( slice : & ' a mut [ Bucket < K , V > ] ) -> Self {
227
+ Self {
228
+ head : slice,
229
+ tail : & mut [ ] ,
230
+ }
223
231
}
224
232
225
233
fn iter ( & self ) -> impl Iterator < Item = & Bucket < K , V > > {
@@ -245,7 +253,7 @@ impl<'a, K: Send, V: Send> ParallelIterator for ParBucketsMut<'a, K, V> {
245
253
}
246
254
}
247
255
248
- impl < ' a , K : Send , V : Send > IndexedParallelIterator for ParBucketsMut < ' a , K , V > {
256
+ impl < K : Send , V : Send > IndexedParallelIterator for ParBucketsMut < ' _ , K , V > {
249
257
fn drive < C > ( self , consumer : C ) -> C :: Result
250
258
where
251
259
C : Consumer < Self :: Item > ,
@@ -293,7 +301,7 @@ where
293
301
294
302
fn into_par_iter ( self ) -> Self :: Iter {
295
303
ParIterMut {
296
- entries : ParBucketsMut :: from_mut_slices ( ( & mut self . entries , & mut [ ] ) ) ,
304
+ entries : ParBucketsMut :: from_mut_slice ( & mut self . entries ) ,
297
305
}
298
306
}
299
307
}
@@ -407,7 +415,7 @@ where
407
415
/// in the slice is still preserved for operations like `reduce` and `collect`.
408
416
pub fn par_keys ( & self ) -> ParKeys < ' _ , K , V > {
409
417
ParKeys {
410
- entries : ParBuckets :: from_slices ( ( & self . entries , & [ ] ) ) ,
418
+ entries : ParBuckets :: from_slice ( & self . entries ) ,
411
419
}
412
420
}
413
421
@@ -417,7 +425,7 @@ where
417
425
/// in the slice is still preserved for operations like `reduce` and `collect`.
418
426
pub fn par_values ( & self ) -> ParValues < ' _ , K , V > {
419
427
ParValues {
420
- entries : ParBuckets :: from_slices ( ( & self . entries , & [ ] ) ) ,
428
+ entries : ParBuckets :: from_slice ( & self . entries ) ,
421
429
}
422
430
}
423
431
}
@@ -530,7 +538,7 @@ where
530
538
/// in the slice is still preserved for operations like `reduce` and `collect`.
531
539
pub fn par_values_mut ( & mut self ) -> ParValuesMut < ' _ , K , V > {
532
540
ParValuesMut {
533
- entries : ParBucketsMut :: from_mut_slices ( ( & mut self . entries , & mut [ ] ) ) ,
541
+ entries : ParBucketsMut :: from_mut_slice ( & mut self . entries ) ,
534
542
}
535
543
}
536
544
}
0 commit comments