| 1 |
//! Parallel iterator types for [`OrderMap`] with [`rayon`]. |
| 2 |
//! |
| 3 |
//! You will rarely need to interact with this module directly unless you need to name one of the |
| 4 |
//! iterator types. |
| 5 |
|
| 6 |
pub use indexmaprust-analyzer cargo indexmap 2.14.0 crate/::maprust-analyzer cargo indexmap 2.14.0 map/::rayonrust-analyzer cargo indexmap 2.14.0 rayon/map/::{ |
| 7 |
IntoParIterrust-analyzer cargo indexmap 2.14.0 rayon/map/IntoParIter#, ParDrainrust-analyzer cargo indexmap 2.14.0 rayon/map/ParDrain#, ParIterrust-analyzer cargo indexmap 2.14.0 rayon/map/ParIter#, ParIterMutrust-analyzer cargo indexmap 2.14.0 rayon/map/ParIterMut#, ParKeysrust-analyzer cargo indexmap 2.14.0 rayon/map/ParKeys#, ParValuesrust-analyzer cargo indexmap 2.14.0 rayon/map/ParValues#, ParValuesMutrust-analyzer cargo indexmap 2.14.0 rayon/map/ParValuesMut#, |
| 8 |
}; |
| 9 |
|
| 10 |
use superrust-analyzer cargo ordermap 1.2.0 map/::OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#; |
| 11 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#; |
| 12 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::{BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher#, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#}; |
| 13 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#; |
| 14 |
use rayonrust-analyzer cargo rayon 1.11.0 crate/::preluderust-analyzer cargo rayon 1.11.0 prelude/::*; |
| 15 |
|
| 16 |
impl<K, V, S> IntoParallelIteratorrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator# for OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 17 |
where |
| 18 |
K: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 19 |
V: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 20 |
{ |
| 21 |
type Itemrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][IntoParallelIterator]Item# = (K, V); |
| 22 |
type Iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][IntoParallelIterator]Iter# = IntoParIterrust-analyzer cargo indexmap 2.14.0 rayon/map/IntoParIter#<K, V>; |
| 23 |
|
| 24 |
fn into_par_iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][IntoParallelIterator]into_par_iter().(self) -> Selfrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][IntoParallelIterator]::Iterrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#Iter# { |
| 25 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..into_par_iterrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`][IntoParallelIterator]into_par_iter().() |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
impl<'a, K, V, S> IntoParallelIteratorrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator# for &'a OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 30 |
where |
| 31 |
K: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 32 |
V: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 33 |
{ |
| 34 |
type Itemrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a OrderMap<K, V, S>`][IntoParallelIterator]Item# = (&'a K, &'a V); |
| 35 |
type Iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a OrderMap<K, V, S>`][IntoParallelIterator]Iter# = ParIterrust-analyzer cargo indexmap 2.14.0 rayon/map/ParIter#<'a, K, V>; |
| 36 |
|
| 37 |
fn into_par_iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a OrderMap<K, V, S>`][IntoParallelIterator]into_par_iter().(self) -> Selfrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a OrderMap<K, V, S>`][IntoParallelIterator]::Iterrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#Iter# { |
| 38 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_iterrust-analyzer cargo rayon 1.11.0 iter/impl#[I][`IntoParallelRefIterator<'data>`]par_iter().() |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
impl<'a, K, V, S> IntoParallelIteratorrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator# for &'a mut OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 43 |
where |
| 44 |
K: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 45 |
V: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 46 |
{ |
| 47 |
type Itemrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a mut OrderMap<K, V, S>`][IntoParallelIterator]Item# = (&'a K, &'a mut V); |
| 48 |
type Iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a mut OrderMap<K, V, S>`][IntoParallelIterator]Iter# = ParIterMutrust-analyzer cargo indexmap 2.14.0 rayon/map/ParIterMut#<'a, K, V>; |
| 49 |
|
| 50 |
fn into_par_iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a mut OrderMap<K, V, S>`][IntoParallelIterator]into_par_iter().(self) -> Selfrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a mut OrderMap<K, V, S>`][IntoParallelIterator]::Iterrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#Iter# { |
| 51 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_iter_mutrust-analyzer cargo rayon 1.11.0 iter/impl#[I][`IntoParallelRefMutIterator<'data>`]par_iter_mut().() |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
impl<'a, K, V, S> ParallelDrainRangerust-analyzer cargo rayon 1.11.0 iter/ParallelDrainRange#<usize> for &'a mut OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 56 |
where |
| 57 |
K: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 58 |
V: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 59 |
{ |
| 60 |
type Itemrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a mut OrderMap<K, V, S>`][`ParallelDrainRange<usize>`]Item# = (K, V); |
| 61 |
type Iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a mut OrderMap<K, V, S>`][`ParallelDrainRange<usize>`]Iter# = ParDrainrust-analyzer cargo indexmap 2.14.0 rayon/map/ParDrain#<'a, K, V>; |
| 62 |
|
| 63 |
fn par_drainrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a mut OrderMap<K, V, S>`][`ParallelDrainRange<usize>`]par_drain().<R: RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#<usize>>(self, range: R) -> Selfrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`&'a mut OrderMap<K, V, S>`][`ParallelDrainRange<usize>`]::Iterrust-analyzer cargo rayon 1.11.0 iter/ParallelDrainRange#Iter# { |
| 64 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_drainrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`&'a mut IndexMap<K, V, S>`][`ParallelDrainRange<usize>`]par_drain().(range) |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
/// Parallel iterator methods and other parallel methods. |
| 69 |
/// |
| 70 |
/// The following methods **require crate feature `"rayon"`**. |
| 71 |
/// |
| 72 |
/// See also the `IntoParallelIterator` implementations. |
| 73 |
impl<K, V, S> OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 74 |
where |
| 75 |
K: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 76 |
V: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 77 |
{ |
| 78 |
/// Return a parallel iterator over the keys of the map. |
| 79 |
/// |
| 80 |
/// While parallel iterators can process items in any order, their relative order |
| 81 |
/// in the map is still preserved for operations like `reduce` and `collect`. |
| 82 |
pub fn par_keysrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_keys().(&self) -> ParKeysrust-analyzer cargo indexmap 2.14.0 rayon/map/ParKeys#<'_, K, V> { |
| 83 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_keysrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_keys().() |
| 84 |
} |
| 85 |
|
| 86 |
/// Return a parallel iterator over the values of the map. |
| 87 |
/// |
| 88 |
/// While parallel iterators can process items in any order, their relative order |
| 89 |
/// in the map is still preserved for operations like `reduce` and `collect`. |
| 90 |
pub fn par_valuesrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_values().(&self) -> ParValuesrust-analyzer cargo indexmap 2.14.0 rayon/map/ParValues#<'_, K, V> { |
| 91 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_valuesrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_values().() |
| 92 |
} |
| 93 |
} |
| 94 |
|
| 95 |
impl<K, V, S> OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 96 |
where |
| 97 |
K: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 98 |
V: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 99 |
{ |
| 100 |
/// Returns `true` if `self` contains all of the same key-value pairs as `other`, |
| 101 |
/// in the same indexed order, determined in parallel. |
| 102 |
pub fn par_eqrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_eq().<S2>(&self, other: &OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S2>) -> bool |
| 103 |
where |
| 104 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#, |
| 105 |
{ |
| 106 |
self.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().other.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().() && self.par_iterrust-analyzer cargo rayon 1.11.0 iter/impl#[I][`IntoParallelRefIterator<'data>`]par_iter().().eqrust-analyzer cargo rayon 1.11.0 iter/IndexedParallelIterator#eq().(other) |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
impl<K, V, S> OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 111 |
where |
| 112 |
K: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 113 |
V: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 114 |
{ |
| 115 |
/// Return a parallel iterator over mutable references to the values of the map |
| 116 |
/// |
| 117 |
/// While parallel iterators can process items in any order, their relative order |
| 118 |
/// in the map is still preserved for operations like `reduce` and `collect`. |
| 119 |
pub fn par_values_mutrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_values_mut().(&mut self) -> ParValuesMutrust-analyzer cargo indexmap 2.14.0 rayon/map/ParValuesMut#<'_, K, V> { |
| 120 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_values_mutrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_values_mut().() |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
impl<K, V, S> OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 125 |
where |
| 126 |
K: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 127 |
V: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 128 |
{ |
| 129 |
/// Sort the map's key-value pairs in parallel, by the default ordering of the keys. |
| 130 |
pub fn par_sort_keysrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sort_keys().(&mut self) |
| 131 |
where |
| 132 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 133 |
{ |
| 134 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sort_keysrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sort_keys().(); |
| 135 |
} |
| 136 |
|
| 137 |
/// Sort the map's key-value pairs in place and in parallel, using the comparison |
| 138 |
/// function `cmp`. |
| 139 |
/// |
| 140 |
/// The comparison function receives two key and value pairs to compare (you |
| 141 |
/// can sort by keys or values or their combination as needed). |
| 142 |
pub fn par_sort_byrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sort_by().<F>(&mut self, cmp: F) |
| 143 |
where |
| 144 |
F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&K, &V, &K, &V) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 145 |
{ |
| 146 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sort_byrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sort_by().(cmp); |
| 147 |
} |
| 148 |
|
| 149 |
/// Sort the key-value pairs of the map in parallel and return a by-value parallel |
| 150 |
/// iterator of the key-value pairs with the result. |
| 151 |
pub fn par_sorted_byrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sorted_by().<F>(self, cmp: F) -> IntoParIterrust-analyzer cargo indexmap 2.14.0 rayon/map/IntoParIter#<K, V> |
| 152 |
where |
| 153 |
F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&K, &V, &K, &V) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 154 |
{ |
| 155 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sorted_byrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sorted_by().(cmp) |
| 156 |
} |
| 157 |
|
| 158 |
/// Sort the map's key-value pairs in place and in parallel, using a sort-key extraction |
| 159 |
/// function. |
| 160 |
pub fn par_sort_by_keyrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sort_by_key().<T, F>(&mut self, sort_key: F) |
| 161 |
where |
| 162 |
T: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 163 |
F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&K, &V) -> T + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 164 |
{ |
| 165 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sort_by_keyrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sort_by_key().(sort_key) |
| 166 |
} |
| 167 |
|
| 168 |
/// Sort the map's key-value pairs in parallel, by the default ordering of the keys. |
| 169 |
pub fn par_sort_unstable_keysrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sort_unstable_keys().(&mut self) |
| 170 |
where |
| 171 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 172 |
{ |
| 173 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sort_unstable_keysrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sort_unstable_keys().(); |
| 174 |
} |
| 175 |
|
| 176 |
/// Sort the map's key-value pairs in place and in parallel, using the comparison |
| 177 |
/// function `cmp`. |
| 178 |
/// |
| 179 |
/// The comparison function receives two key and value pairs to compare (you |
| 180 |
/// can sort by keys or values or their combination as needed). |
| 181 |
pub fn par_sort_unstable_byrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sort_unstable_by().<F>(&mut self, cmp: F) |
| 182 |
where |
| 183 |
F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&K, &V, &K, &V) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 184 |
{ |
| 185 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sort_unstable_byrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sort_unstable_by().(cmp); |
| 186 |
} |
| 187 |
|
| 188 |
/// Sort the key-value pairs of the map in parallel and return a by-value parallel |
| 189 |
/// iterator of the key-value pairs with the result. |
| 190 |
pub fn par_sorted_unstable_byrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sorted_unstable_by().<F>(self, cmp: F) -> IntoParIterrust-analyzer cargo indexmap 2.14.0 rayon/map/IntoParIter#<K, V> |
| 191 |
where |
| 192 |
F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&K, &V, &K, &V) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 193 |
{ |
| 194 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sorted_unstable_byrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sorted_unstable_by().(cmp) |
| 195 |
} |
| 196 |
|
| 197 |
/// Sort the map's key-value pairs in place and in parallel, using a sort-key extraction |
| 198 |
/// function. |
| 199 |
pub fn par_sort_unstable_by_keyrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sort_unstable_by_key().<T, F>(&mut self, sort_key: F) |
| 200 |
where |
| 201 |
T: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 202 |
F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&K, &V) -> T + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 203 |
{ |
| 204 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sort_unstable_by_keyrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sort_unstable_by_key().(sort_key) |
| 205 |
} |
| 206 |
|
| 207 |
/// Sort the map's key-value pairs in place and in parallel, using a sort-key extraction |
| 208 |
/// function. |
| 209 |
pub fn par_sort_by_cached_keyrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_sort_by_cached_key().<T, F>(&mut self, sort_key: F) |
| 210 |
where |
| 211 |
T: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 212 |
F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&K, &V) -> T + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 213 |
{ |
| 214 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_sort_by_cached_keyrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`]par_sort_by_cached_key().(sort_key) |
| 215 |
} |
| 216 |
} |
| 217 |
|
| 218 |
impl<K, V, S> FromParallelIteratorrust-analyzer cargo rayon 1.11.0 iter/FromParallelIterator#<(K, V)> for OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 219 |
where |
| 220 |
K: Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 221 |
V: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 222 |
S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 223 |
{ |
| 224 |
fn from_par_iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][`FromParallelIterator<(K, V)>`]from_par_iter().<I>(iter: I) -> Selfrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][`FromParallelIterator<(K, V)>`] |
| 225 |
where |
| 226 |
I: IntoParallelIteratorrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#<Itemrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#Item# = (K, V)>, |
| 227 |
{ |
| 228 |
Selfrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][`FromParallelIterator<(K, V)>`] { |
| 229 |
innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner.: <_>::from_par_iterrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`][`FromParallelIterator<(K, V)>`]from_par_iter().(iter), |
| 230 |
} |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
impl<K, V, S> ParallelExtendrust-analyzer cargo rayon 1.11.0 iter/ParallelExtend#<(K, V)> for OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 235 |
where |
| 236 |
K: Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 237 |
V: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 238 |
S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 239 |
{ |
| 240 |
fn par_extendrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][`ParallelExtend<(K, V)>`]par_extend().<I>(&mut self, iter: I) |
| 241 |
where |
| 242 |
I: IntoParallelIteratorrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#<Itemrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#Item# = (K, V)>, |
| 243 |
{ |
| 244 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_extendrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`][`ParallelExtend<(K, V)>`]par_extend().(iter); |
| 245 |
} |
| 246 |
} |
| 247 |
|
| 248 |
impl<'a, K: 'a, V: 'a, S> ParallelExtendrust-analyzer cargo rayon 1.11.0 iter/ParallelExtend#<(&'a K, &'a V)> for OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<K, V, S> |
| 249 |
where |
| 250 |
K: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 251 |
V: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 252 |
S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 253 |
{ |
| 254 |
fn par_extendrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][`ParallelExtend<(&'a K, &'a V)>`]par_extend().<I>(&mut self, iter: I) |
| 255 |
where |
| 256 |
I: IntoParallelIteratorrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#<Itemrust-analyzer cargo rayon 1.11.0 iter/IntoParallelIterator#Item# = (&'a K, &'a V)>, |
| 257 |
{ |
| 258 |
self.innerrust-analyzer cargo ordermap 1.2.0 map/OrderMap#inner..par_extendrust-analyzer cargo indexmap 2.14.0 rayon/map/impl#[`IndexMap<K, V, S>`][`ParallelExtend<(&'a K, &'a V)>`]par_extend().(iter); |
| 259 |
} |
| 260 |
} |
| 261 |
|
| •262 |
#[cfg(all(test, feature = "std"))] |
| 263 |
mod testsrust-analyzer cargo ordermap 1.2.0 map/rayon/tests/ { |
| 264 |
use superrust-analyzer cargo ordermap 1.2.0 map/rayon/::*; |
| 265 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#; |
| 266 |
|
| 267 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 268 |
fn insert_orderrust-analyzer cargo ordermap 1.2.0 map/rayon/tests/insert_order().() { |
| 269 |
let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23]; |
| 270 |
let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().(); |
| 271 |
|
| 272 |
for &elt in &insert { |
| 273 |
map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt, ()); |
| 274 |
} |
| 275 |
|
| 276 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.par_keysrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_keys().().countrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#count().(), map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().()); |
| 277 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.par_keysrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_keys().().countrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 278 |
insert.par_iterrust-analyzer cargo rayon 1.11.0 iter/impl#[I][`IntoParallelRefIterator<'data>`]par_iter().().ziprust-analyzer cargo rayon 1.11.0 iter/IndexedParallelIterator#zip().(map.par_keysrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_keys().()).for_eachrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#for_each().(|(a, b)| { |
| 279 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 280 |
}); |
| 281 |
(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) |
| 282 |
.into_par_iterrust-analyzer cargo rayon 1.11.0 range/impl#[`Range<T>`][IntoParallelIterator]into_par_iter().() |
| 283 |
.ziprust-analyzer cargo rayon 1.11.0 iter/IndexedParallelIterator#zip().(map.par_keysrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_keys().()) |
| 284 |
.for_eachrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#for_each().(|(i, k)| { |
| 285 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index().(i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().0, k); |
| 286 |
}); |
| 287 |
} |
| 288 |
|
| 289 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 290 |
fn partial_eq_and_eqrust-analyzer cargo ordermap 1.2.0 map/rayon/tests/partial_eq_and_eq().() { |
| 291 |
let mut map_a = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().(); |
| 292 |
map_a.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, "1"); |
| 293 |
map_a.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(2, "2"); |
| 294 |
let mut map_b = map_a.clonerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Clone]clone().(); |
| 295 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map_a.par_eqrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_eq().(&map_b)); |
| 296 |
map_b.swap_removerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]swap_remove().(&1); |
| 297 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().map_a.par_eqrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_eq().(&map_b)); |
| 298 |
map_b.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, "3"); |
| 299 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().map_a.par_eqrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_eq().(&map_b)); |
| 300 |
} |
| 301 |
|
| 302 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 303 |
fn extendrust-analyzer cargo ordermap 1.2.0 map/rayon/tests/extend().() { |
| 304 |
let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().(); |
| 305 |
map.par_extendrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][`ParallelExtend<(&'a K, &'a V)>`]par_extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(&1, &2), (&3, &4)]); |
| 306 |
map.par_extendrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][`ParallelExtend<(K, V)>`]par_extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(5, 6)]); |
| 307 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 308 |
map.into_par_iterrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`][IntoParallelIterator]into_par_iter().().collectrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 309 |
vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 2), (3, 4), (5, 6)] |
| 310 |
); |
| 311 |
} |
| 312 |
|
| 313 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 314 |
fn keysrust-analyzer cargo ordermap 1.2.0 map/rayon/tests/keys().() { |
| 315 |
let vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 'a'), (2, 'b'), (3, 'c')]; |
| 316 |
let map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, _> = vec.into_par_iterrust-analyzer cargo rayon 1.11.0 vec/impl#[`Vec<T>`][IntoParallelIterator]into_par_iter().().collectrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#collect().(); |
| 317 |
let keys: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = map.par_keysrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_keys().().copiedrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#copied().().collectrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#collect().(); |
| 318 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(keys.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3); |
| 319 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&1)); |
| 320 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&2)); |
| 321 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&3)); |
| 322 |
} |
| 323 |
|
| 324 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 325 |
fn valuesrust-analyzer cargo ordermap 1.2.0 map/rayon/tests/values().() { |
| 326 |
let vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 'a'), (2, 'b'), (3, 'c')]; |
| 327 |
let map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, _> = vec.into_par_iterrust-analyzer cargo rayon 1.11.0 vec/impl#[`Vec<T>`][IntoParallelIterator]into_par_iter().().collectrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#collect().(); |
| 328 |
let values: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = map.par_valuesrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_values().().copiedrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#copied().().collectrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#collect().(); |
| 329 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3); |
| 330 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'a')); |
| 331 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'b')); |
| 332 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'c')); |
| 333 |
} |
| 334 |
|
| 335 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 336 |
fn values_mutrust-analyzer cargo ordermap 1.2.0 map/rayon/tests/values_mut().() { |
| 337 |
let vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 1), (2, 2), (3, 3)]; |
| 338 |
let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, _> = vec.into_par_iterrust-analyzer cargo rayon 1.11.0 vec/impl#[`Vec<T>`][IntoParallelIterator]into_par_iter().().collectrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#collect().(); |
| 339 |
map.par_values_mutrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_values_mut().().for_eachrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#for_each().(|value| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign().2); |
| 340 |
let values: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = map.par_valuesrust-analyzer cargo ordermap 1.2.0 map/rayon/impl#[`OrderMap<K, V, S>`]par_values().().copiedrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#copied().().collectrust-analyzer cargo rayon 1.11.0 iter/ParallelIterator#collect().(); |
| 341 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3); |
| 342 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&2)); |
| 343 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&4)); |
| 344 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&6)); |
| 345 |
} |
| 346 |
} |