11//! Rayon extensions for `HashMap`.
22
33use crate :: hash_map:: HashMap ;
4- use crate :: raw:: { AllocRef , Global } ;
4+ use crate :: raw:: { Allocator , Global } ;
55use core:: fmt;
66use core:: hash:: { BuildHasher , Hash } ;
77use rayon:: iter:: plumbing:: UnindexedConsumer ;
@@ -16,11 +16,11 @@ use rayon::iter::{FromParallelIterator, IntoParallelIterator, ParallelExtend, Pa
1616/// [`par_iter`]: /hashbrown/struct.HashMap.html#method.par_iter
1717/// [`HashMap`]: /hashbrown/struct.HashMap.html
1818/// [`IntoParallelRefIterator`]: https://docs.rs/rayon/1.0/rayon/iter/trait.IntoParallelRefIterator.html
19- pub struct ParIter < ' a , K , V , S , A : AllocRef + Clone = Global > {
19+ pub struct ParIter < ' a , K , V , S , A : Allocator + Clone = Global > {
2020 map : & ' a HashMap < K , V , S , A > ,
2121}
2222
23- impl < ' a , K : Sync , V : Sync , S : Sync , A : AllocRef + Clone + Sync > ParallelIterator
23+ impl < ' a , K : Sync , V : Sync , S : Sync , A : Allocator + Clone + Sync > ParallelIterator
2424 for ParIter < ' a , K , V , S , A >
2525{
2626 type Item = ( & ' a K , & ' a V ) ;
@@ -39,14 +39,14 @@ impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator
3939 }
4040}
4141
42- impl < K , V , S , A : AllocRef + Clone > Clone for ParIter < ' _ , K , V , S , A > {
42+ impl < K , V , S , A : Allocator + Clone > Clone for ParIter < ' _ , K , V , S , A > {
4343 #[ cfg_attr( feature = "inline-more" , inline) ]
4444 fn clone ( & self ) -> Self {
4545 ParIter { map : self . map }
4646 }
4747}
4848
49- impl < K : fmt:: Debug + Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : AllocRef + Clone > fmt:: Debug
49+ impl < K : fmt:: Debug + Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : Allocator + Clone > fmt:: Debug
5050 for ParIter < ' _ , K , V , S , A >
5151{
5252 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -61,11 +61,11 @@ impl<K: fmt::Debug + Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clo
6161///
6262/// [`par_keys`]: /hashbrown/struct.HashMap.html#method.par_keys
6363/// [`HashMap`]: /hashbrown/struct.HashMap.html
64- pub struct ParKeys < ' a , K , V , S , A : AllocRef + Clone > {
64+ pub struct ParKeys < ' a , K , V , S , A : Allocator + Clone > {
6565 map : & ' a HashMap < K , V , S , A > ,
6666}
6767
68- impl < ' a , K : Sync , V : Sync , S : Sync , A : AllocRef + Clone + Sync > ParallelIterator
68+ impl < ' a , K : Sync , V : Sync , S : Sync , A : Allocator + Clone + Sync > ParallelIterator
6969 for ParKeys < ' a , K , V , S , A >
7070{
7171 type Item = & ' a K ;
@@ -81,14 +81,14 @@ impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator
8181 }
8282}
8383
84- impl < K , V , S , A : AllocRef + Clone > Clone for ParKeys < ' _ , K , V , S , A > {
84+ impl < K , V , S , A : Allocator + Clone > Clone for ParKeys < ' _ , K , V , S , A > {
8585 #[ cfg_attr( feature = "inline-more" , inline) ]
8686 fn clone ( & self ) -> Self {
8787 ParKeys { map : self . map }
8888 }
8989}
9090
91- impl < K : fmt:: Debug + Eq + Hash , V , S : BuildHasher , A : AllocRef + Clone > fmt:: Debug
91+ impl < K : fmt:: Debug + Eq + Hash , V , S : BuildHasher , A : Allocator + Clone > fmt:: Debug
9292 for ParKeys < ' _ , K , V , S , A >
9393{
9494 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -103,11 +103,11 @@ impl<K: fmt::Debug + Eq + Hash, V, S: BuildHasher, A: AllocRef + Clone> fmt::Deb
103103///
104104/// [`par_values`]: /hashbrown/struct.HashMap.html#method.par_values
105105/// [`HashMap`]: /hashbrown/struct.HashMap.html
106- pub struct ParValues < ' a , K , V , S , A : AllocRef + Clone = Global > {
106+ pub struct ParValues < ' a , K , V , S , A : Allocator + Clone = Global > {
107107 map : & ' a HashMap < K , V , S , A > ,
108108}
109109
110- impl < ' a , K : Sync , V : Sync , S : Sync , A : AllocRef + Clone + Sync > ParallelIterator
110+ impl < ' a , K : Sync , V : Sync , S : Sync , A : Allocator + Clone + Sync > ParallelIterator
111111 for ParValues < ' a , K , V , S , A >
112112{
113113 type Item = & ' a V ;
@@ -123,14 +123,14 @@ impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator
123123 }
124124}
125125
126- impl < K , V , S , A : AllocRef + Clone > Clone for ParValues < ' _ , K , V , S , A > {
126+ impl < K , V , S , A : Allocator + Clone > Clone for ParValues < ' _ , K , V , S , A > {
127127 #[ cfg_attr( feature = "inline-more" , inline) ]
128128 fn clone ( & self ) -> Self {
129129 ParValues { map : self . map }
130130 }
131131}
132132
133- impl < K : Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : AllocRef + Clone > fmt:: Debug
133+ impl < K : Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : Allocator + Clone > fmt:: Debug
134134 for ParValues < ' _ , K , V , S , A >
135135{
136136 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -147,11 +147,11 @@ impl<K: Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debu
147147/// [`par_iter_mut`]: /hashbrown/struct.HashMap.html#method.par_iter_mut
148148/// [`HashMap`]: /hashbrown/struct.HashMap.html
149149/// [`IntoParallelRefMutIterator`]: https://docs.rs/rayon/1.0/rayon/iter/trait.IntoParallelRefMutIterator.html
150- pub struct ParIterMut < ' a , K , V , S , A : AllocRef + Clone > {
150+ pub struct ParIterMut < ' a , K , V , S , A : Allocator + Clone > {
151151 map : & ' a mut HashMap < K , V , S , A > ,
152152}
153153
154- impl < ' a , K : Send + Sync , V : Send , S : Send , A : AllocRef + Clone + Sync > ParallelIterator
154+ impl < ' a , K : Send + Sync , V : Send , S : Send , A : Allocator + Clone + Sync > ParallelIterator
155155 for ParIterMut < ' a , K , V , S , A >
156156{
157157 type Item = ( & ' a K , & ' a mut V ) ;
@@ -170,7 +170,7 @@ impl<'a, K: Send + Sync, V: Send, S: Send, A: AllocRef + Clone + Sync> ParallelI
170170 }
171171}
172172
173- impl < K : fmt:: Debug + Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : AllocRef + Clone > fmt:: Debug
173+ impl < K : fmt:: Debug + Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : Allocator + Clone > fmt:: Debug
174174 for ParIterMut < ' _ , K , V , S , A >
175175{
176176 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -185,11 +185,11 @@ impl<K: fmt::Debug + Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clo
185185///
186186/// [`par_values_mut`]: /hashbrown/struct.HashMap.html#method.par_values_mut
187187/// [`HashMap`]: /hashbrown/struct.HashMap.html
188- pub struct ParValuesMut < ' a , K , V , S , A : AllocRef + Clone = Global > {
188+ pub struct ParValuesMut < ' a , K , V , S , A : Allocator + Clone = Global > {
189189 map : & ' a mut HashMap < K , V , S , A > ,
190190}
191191
192- impl < ' a , K : Send , V : Send , S : Send , A : AllocRef + Clone + Send > ParallelIterator
192+ impl < ' a , K : Send , V : Send , S : Send , A : Allocator + Clone + Send > ParallelIterator
193193 for ParValuesMut < ' a , K , V , S , A >
194194{
195195 type Item = & ' a mut V ;
@@ -205,7 +205,7 @@ impl<'a, K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> ParallelIterator
205205 }
206206}
207207
208- impl < K : Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : AllocRef + Clone > fmt:: Debug
208+ impl < K : Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : Allocator + Clone > fmt:: Debug
209209 for ParValuesMut < ' _ , K , V , S , A >
210210{
211211 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -222,11 +222,11 @@ impl<K: Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debu
222222/// [`into_par_iter`]: /hashbrown/struct.HashMap.html#method.into_par_iter
223223/// [`HashMap`]: /hashbrown/struct.HashMap.html
224224/// [`IntoParallelIterator`]: https://docs.rs/rayon/1.0/rayon/iter/trait.IntoParallelIterator.html
225- pub struct IntoParIter < K , V , S , A : AllocRef + Clone = Global > {
225+ pub struct IntoParIter < K , V , S , A : Allocator + Clone = Global > {
226226 map : HashMap < K , V , S , A > ,
227227}
228228
229- impl < K : Send , V : Send , S : Send , A : AllocRef + Clone + Send > ParallelIterator
229+ impl < K : Send , V : Send , S : Send , A : Allocator + Clone + Send > ParallelIterator
230230 for IntoParIter < K , V , S , A >
231231{
232232 type Item = ( K , V ) ;
@@ -240,7 +240,7 @@ impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> ParallelIterator
240240 }
241241}
242242
243- impl < K : fmt:: Debug + Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : AllocRef + Clone > fmt:: Debug
243+ impl < K : fmt:: Debug + Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : Allocator + Clone > fmt:: Debug
244244 for IntoParIter < K , V , S , A >
245245{
246246 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -255,11 +255,11 @@ impl<K: fmt::Debug + Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clo
255255///
256256/// [`par_drain`]: /hashbrown/struct.HashMap.html#method.par_drain
257257/// [`HashMap`]: /hashbrown/struct.HashMap.html
258- pub struct ParDrain < ' a , K , V , S , A : AllocRef + Clone = Global > {
258+ pub struct ParDrain < ' a , K , V , S , A : Allocator + Clone = Global > {
259259 map : & ' a mut HashMap < K , V , S , A > ,
260260}
261261
262- impl < K : Send , V : Send , S : Send , A : AllocRef + Clone + Sync > ParallelIterator
262+ impl < K : Send , V : Send , S : Send , A : Allocator + Clone + Sync > ParallelIterator
263263 for ParDrain < ' _ , K , V , S , A >
264264{
265265 type Item = ( K , V ) ;
@@ -273,15 +273,15 @@ impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Sync> ParallelIterator
273273 }
274274}
275275
276- impl < K : fmt:: Debug + Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : AllocRef + Clone > fmt:: Debug
276+ impl < K : fmt:: Debug + Eq + Hash , V : fmt:: Debug , S : BuildHasher , A : Allocator + Clone > fmt:: Debug
277277 for ParDrain < ' _ , K , V , S , A >
278278{
279279 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
280280 self . map . iter ( ) . fmt ( f)
281281 }
282282}
283283
284- impl < K : Sync , V : Sync , S : Sync , A : AllocRef + Clone + Sync > HashMap < K , V , S , A > {
284+ impl < K : Sync , V : Sync , S : Sync , A : Allocator + Clone + Sync > HashMap < K , V , S , A > {
285285 /// Visits (potentially in parallel) immutably borrowed keys in an arbitrary order.
286286 #[ cfg_attr( feature = "inline-more" , inline) ]
287287 pub fn par_keys ( & self ) -> ParKeys < ' _ , K , V , S , A > {
@@ -295,7 +295,7 @@ impl<K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> HashMap<K, V, S, A>
295295 }
296296}
297297
298- impl < K : Send , V : Send , S : Send , A : AllocRef + Clone + Sync > HashMap < K , V , S , A > {
298+ impl < K : Send , V : Send , S : Send , A : Allocator + Clone + Sync > HashMap < K , V , S , A > {
299299 /// Visits (potentially in parallel) mutably borrowed values in an arbitrary order.
300300 #[ cfg_attr( feature = "inline-more" , inline) ]
301301 pub fn par_values_mut ( & mut self ) -> ParValuesMut < ' _ , K , V , S , A > {
@@ -315,7 +315,7 @@ where
315315 K : Eq + Hash + Sync ,
316316 V : PartialEq + Sync ,
317317 S : BuildHasher + Sync ,
318- A : AllocRef + Clone + Sync ,
318+ A : Allocator + Clone + Sync ,
319319{
320320 /// Returns `true` if the map is equal to another,
321321 /// i.e. both maps contain the same keys mapped to the same values.
@@ -329,7 +329,7 @@ where
329329 }
330330}
331331
332- impl < K : Send , V : Send , S : Send , A : AllocRef + Clone + Send > IntoParallelIterator
332+ impl < K : Send , V : Send , S : Send , A : Allocator + Clone + Send > IntoParallelIterator
333333 for HashMap < K , V , S , A >
334334{
335335 type Item = ( K , V ) ;
@@ -341,7 +341,7 @@ impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> IntoParallelIterator
341341 }
342342}
343343
344- impl < ' a , K : Sync , V : Sync , S : Sync , A : AllocRef + Clone + Sync > IntoParallelIterator
344+ impl < ' a , K : Sync , V : Sync , S : Sync , A : Allocator + Clone + Sync > IntoParallelIterator
345345 for & ' a HashMap < K , V , S , A >
346346{
347347 type Item = ( & ' a K , & ' a V ) ;
@@ -353,7 +353,7 @@ impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> IntoParallelIter
353353 }
354354}
355355
356- impl < ' a , K : Send + Sync , V : Send , S : Send , A : AllocRef + Clone + Sync > IntoParallelIterator
356+ impl < ' a , K : Send + Sync , V : Send , S : Send , A : Allocator + Clone + Sync > IntoParallelIterator
357357 for & ' a mut HashMap < K , V , S , A >
358358{
359359 type Item = ( & ' a K , & ' a mut V ) ;
@@ -391,7 +391,7 @@ where
391391 K : Eq + Hash + Send ,
392392 V : Send ,
393393 S : BuildHasher ,
394- A : AllocRef + Clone ,
394+ A : Allocator + Clone ,
395395{
396396 fn par_extend < I > ( & mut self , par_iter : I )
397397 where
@@ -407,7 +407,7 @@ where
407407 K : Copy + Eq + Hash + Sync ,
408408 V : Copy + Sync ,
409409 S : BuildHasher ,
410- A : AllocRef + Clone ,
410+ A : Allocator + Clone ,
411411{
412412 fn par_extend < I > ( & mut self , par_iter : I )
413413 where
@@ -423,7 +423,7 @@ where
423423 K : Eq + Hash ,
424424 S : BuildHasher ,
425425 I : IntoParallelIterator ,
426- A : AllocRef + Clone ,
426+ A : Allocator + Clone ,
427427 HashMap < K , V , S , A > : Extend < I :: Item > ,
428428{
429429 let ( list, len) = super :: helpers:: collect ( par_iter) ;
0 commit comments