Skip to content

Commit f596c9e

Browse files
committed
Limit the with_min_len method to those parallel wrappers where it would not shadow a trait method
Additionally, the min_len field does not affect those parallel iterators which are indexed as the splitting positions are chosen by Rayon which has its own `with_min_len` method to achieve the same effect.
1 parent 25b7eff commit f596c9e

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

src/parallel/par.rs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ pub struct Parallel<I> {
2424
min_len: usize,
2525
}
2626

27-
impl<I> Parallel<I> {
28-
/// Sets the minimum number of elements desired to process in each job. This will not be split any smaller than this length, but of course a producer could already be smaller to begin with.
29-
pub fn with_min_len(self, min_len: usize) -> Self {
30-
Self {
31-
min_len,
32-
..self
33-
}
34-
}
35-
}
36-
3727
const DEFAULT_MIN_LEN: usize = 1;
3828

3929
/// Parallel producer wrapper.
@@ -150,7 +140,6 @@ macro_rules! par_iter_view_wrapper {
150140
}
151141
}
152142

153-
154143
impl<'a, A, D> ParallelIterator for Parallel<$view_name<'a, A, D>>
155144
where D: Dimension,
156145
A: $($thread_bounds)*,
@@ -167,6 +156,19 @@ macro_rules! par_iter_view_wrapper {
167156
}
168157
}
169158

159+
impl<'a, A, D> Parallel<$view_name<'a, A, D>>
160+
where D: Dimension,
161+
A: $($thread_bounds)*,
162+
{
163+
/// Sets the minimum number of elements desired to process in each job. This will not be split any smaller than this length, but of course a producer could already be smaller to begin with.
164+
pub fn with_min_len(self, min_len: usize) -> Self {
165+
Self {
166+
min_len,
167+
..self
168+
}
169+
}
170+
}
171+
170172
impl<'a, A, D> UnindexedProducer for ParallelProducer<$view_name<'a, A, D>>
171173
where D: Dimension,
172174
A: $($thread_bounds)*,
@@ -300,6 +302,19 @@ zip_impl! {
300302
[P1 P2 P3 P4 P5 P6],
301303
}
302304

305+
impl<D, Parts> Parallel<Zip<Parts, D>>
306+
where
307+
D: Dimension,
308+
{
309+
/// Sets the minimum number of elements desired to process in each job. This will not be split any smaller than this length, but of course a producer could already be smaller to begin with.
310+
pub fn with_min_len(self, min_len: usize) -> Self {
311+
Self {
312+
min_len,
313+
..self
314+
}
315+
}
316+
}
317+
303318
/// A parallel iterator (unindexed) that produces the splits of the array
304319
/// or producer `P`.
305320
pub(crate) struct ParallelSplits<P> {

0 commit comments

Comments
 (0)