|
1 |
| -use super::{IndexedParallelIterator, IntoParallelIterator, ParallelExtend, ParallelIterator}; |
| 1 | +use super::{IndexedParallelIterator, ParallelIterator}; |
2 | 2 | use std::mem::MaybeUninit;
|
3 | 3 | use std::slice;
|
4 | 4 |
|
|
33 | 33 | /// *any* `ParallelIterator` here, and `CollectConsumer` has to also implement
|
34 | 34 | /// `UnindexedConsumer`. That implementation panics `unreachable!` in case
|
35 | 35 | /// there's a bug where we actually do try to use this unindexed.
|
36 |
| -fn special_extend<I, T>(pi: I, len: usize, v: &mut Vec<T>) |
| 36 | +pub(super) fn special_extend<I, T>(pi: I, len: usize, v: &mut Vec<T>) |
37 | 37 | where
|
38 | 38 | I: ParallelIterator<Item = T>,
|
39 | 39 | T: Send,
|
@@ -141,33 +141,3 @@ impl<'c, T: Send + 'c> Collect<'c, T> {
|
141 | 141 | unsafe { slice::from_raw_parts_mut(tail_ptr, len) }
|
142 | 142 | }
|
143 | 143 | }
|
144 |
| - |
145 |
| -/// Extends a vector with items from a parallel iterator. |
146 |
| -impl<T> ParallelExtend<T> for Vec<T> |
147 |
| -where |
148 |
| - T: Send, |
149 |
| -{ |
150 |
| - fn par_extend<I>(&mut self, par_iter: I) |
151 |
| - where |
152 |
| - I: IntoParallelIterator<Item = T>, |
153 |
| - { |
154 |
| - // See the vec_collect benchmarks in rayon-demo for different strategies. |
155 |
| - let par_iter = par_iter.into_par_iter(); |
156 |
| - match par_iter.opt_len() { |
157 |
| - Some(len) => { |
158 |
| - // When Rust gets specialization, we can get here for indexed iterators |
159 |
| - // without relying on `opt_len`. Until then, `special_extend()` fakes |
160 |
| - // an unindexed mode on the promise that `opt_len()` is accurate. |
161 |
| - special_extend(par_iter, len, self); |
162 |
| - } |
163 |
| - None => { |
164 |
| - // This works like `extend`, but `Vec::append` is more efficient. |
165 |
| - let list = super::extend::collect(par_iter); |
166 |
| - self.reserve(super::extend::len(&list)); |
167 |
| - for mut vec in list { |
168 |
| - self.append(&mut vec); |
169 |
| - } |
170 |
| - } |
171 |
| - } |
172 |
| - } |
173 |
| -} |
0 commit comments