[−]Trait astral::thirdparty::rayon::iter::ParallelExtend
ParallelExtend
extends an existing collection with items from a ParallelIterator
.
Examples
Implementing ParallelExtend
for your type:
use rayon::prelude::*; use std::mem; struct BlackHole { mass: usize, } impl<T: Send> ParallelExtend<T> for BlackHole { fn par_extend<I>(&mut self, par_iter: I) where I: IntoParallelIterator<Item = T> { let par_iter = par_iter.into_par_iter(); self.mass += par_iter.count() * mem::size_of::<T>(); } } let mut bh = BlackHole { mass: 0 }; bh.par_extend(0i32..1000); assert_eq!(bh.mass, 4000); bh.par_extend(0i64..10); assert_eq!(bh.mass, 4080);
Required methods
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
I: IntoParallelIterator<Item = T>,
Extends an instance of the collection with the elements drawn
from the parallel iterator par_iter
.
Examples
use rayon::prelude::*; let mut vec = vec![]; vec.par_extend(0..5); vec.par_extend((0..5).into_par_iter().map(|i| i * i)); assert_eq!(vec, [0, 1, 2, 3, 4, 0, 1, 4, 9, 16]);
Implementations on Foreign Types
impl<K, V, S> ParallelExtend<(K, V)> for HashMap<K, V, S> where
K: Eq + Hash + Send,
S: BuildHasher + Send,
V: Send,
[src]
K: Eq + Hash + Send,
S: BuildHasher + Send,
V: Send,
Extend a hash map with items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = (K, V)>,
[src]
I: IntoParallelIterator<Item = (K, V)>,
impl<'a, T> ParallelExtend<&'a T> for Vec<T> where
T: 'a + Copy + Send + Sync,
[src]
T: 'a + Copy + Send + Sync,
Extend a vector with copied items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a T>,
[src]
I: IntoParallelIterator<Item = &'a T>,
impl<'a, T> ParallelExtend<&'a T> for BTreeSet<T> where
T: 'a + Copy + Ord + Send + Sync,
[src]
T: 'a + Copy + Ord + Send + Sync,
Extend a B-tree set with copied items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a T>,
[src]
I: IntoParallelIterator<Item = &'a T>,
impl<'a, T, S> ParallelExtend<&'a T> for HashSet<T, S> where
S: BuildHasher + Send,
T: 'a + Copy + Eq + Hash + Send + Sync,
[src]
S: BuildHasher + Send,
T: 'a + Copy + Eq + Hash + Send + Sync,
Extend a hash set with copied items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a T>,
[src]
I: IntoParallelIterator<Item = &'a T>,
impl<T> ParallelExtend<T> for BinaryHeap<T> where
T: Ord + Send,
[src]
T: Ord + Send,
Extend a binary heap with items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
[src]
I: IntoParallelIterator<Item = T>,
impl<T, S> ParallelExtend<T> for HashSet<T, S> where
S: BuildHasher + Send,
T: Eq + Hash + Send,
[src]
S: BuildHasher + Send,
T: Eq + Hash + Send,
Extend a hash set with items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
[src]
I: IntoParallelIterator<Item = T>,
impl<'a, K, V> ParallelExtend<(&'a K, &'a V)> for BTreeMap<K, V> where
K: Copy + Ord + Send + Sync,
V: Copy + Send + Sync,
[src]
K: Copy + Ord + Send + Sync,
V: Copy + Send + Sync,
Extend a B-tree map with copied items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = (&'a K, &'a V)>,
[src]
I: IntoParallelIterator<Item = (&'a K, &'a V)>,
impl<K, V> ParallelExtend<(K, V)> for BTreeMap<K, V> where
K: Ord + Send,
V: Send,
[src]
K: Ord + Send,
V: Send,
Extend a B-tree map with items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = (K, V)>,
[src]
I: IntoParallelIterator<Item = (K, V)>,
impl<T> ParallelExtend<T> for VecDeque<T> where
T: Send,
[src]
T: Send,
Extend a deque with items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
[src]
I: IntoParallelIterator<Item = T>,
impl<T> ParallelExtend<T> for BTreeSet<T> where
T: Ord + Send,
[src]
T: Ord + Send,
Extend a B-tree set with items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
[src]
I: IntoParallelIterator<Item = T>,
impl<A, B, FromA, FromB> ParallelExtend<(A, B)> for (FromA, FromB) where
A: Send,
B: Send,
FromA: Send + ParallelExtend<A>,
FromB: Send + ParallelExtend<B>,
[src]
A: Send,
B: Send,
FromA: Send + ParallelExtend<A>,
FromB: Send + ParallelExtend<B>,
fn par_extend<I>(&mut self, pi: I) where
I: IntoParallelIterator<Item = (A, B)>,
[src]
I: IntoParallelIterator<Item = (A, B)>,
impl<'a, K, V, S> ParallelExtend<(&'a K, &'a V)> for HashMap<K, V, S> where
K: Copy + Eq + Hash + Send + Sync,
S: BuildHasher + Send,
V: Copy + Send + Sync,
[src]
K: Copy + Eq + Hash + Send + Sync,
S: BuildHasher + Send,
V: Copy + Send + Sync,
Extend a hash map with copied items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = (&'a K, &'a V)>,
[src]
I: IntoParallelIterator<Item = (&'a K, &'a V)>,
impl<L, R, A, B> ParallelExtend<Either<L, R>> for (A, B) where
A: Send + ParallelExtend<L>,
B: Send + ParallelExtend<R>,
L: Send,
R: Send,
[src]
A: Send + ParallelExtend<L>,
B: Send + ParallelExtend<R>,
L: Send,
R: Send,
fn par_extend<I>(&mut self, pi: I) where
I: IntoParallelIterator<Item = Either<L, R>>,
[src]
I: IntoParallelIterator<Item = Either<L, R>>,
impl<T> ParallelExtend<T> for LinkedList<T> where
T: Send,
[src]
T: Send,
Extend a linked list with items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
[src]
I: IntoParallelIterator<Item = T>,
impl<T> ParallelExtend<T> for Vec<T> where
T: Send,
[src]
T: Send,
Extend a vector with items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
[src]
I: IntoParallelIterator<Item = T>,
impl<'a, T> ParallelExtend<&'a T> for LinkedList<T> where
T: 'a + Copy + Send + Sync,
[src]
T: 'a + Copy + Send + Sync,
Extend a linked list with copied items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a T>,
[src]
I: IntoParallelIterator<Item = &'a T>,
impl<'a, T> ParallelExtend<&'a T> for BinaryHeap<T> where
T: 'a + Copy + Ord + Send + Sync,
[src]
T: 'a + Copy + Ord + Send + Sync,
Extend a binary heap with copied items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a T>,
[src]
I: IntoParallelIterator<Item = &'a T>,
impl<'a, T> ParallelExtend<&'a T> for VecDeque<T> where
T: 'a + Copy + Send + Sync,
[src]
T: 'a + Copy + Send + Sync,
Extend a deque with copied items from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a T>,
[src]
I: IntoParallelIterator<Item = &'a T>,
Implementors
impl ParallelExtend<char> for String
[src]
Extend a string with characters from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = char>,
[src]
I: IntoParallelIterator<Item = char>,
impl ParallelExtend<String> for String
[src]
Extend a string with strings from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = String>,
[src]
I: IntoParallelIterator<Item = String>,
impl<'a> ParallelExtend<&'a char> for String
[src]
Extend a string with copied characters from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a char>,
[src]
I: IntoParallelIterator<Item = &'a char>,
impl<'a> ParallelExtend<&'a str> for String
[src]
Extend a string with string slices from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a str>,
[src]
I: IntoParallelIterator<Item = &'a str>,
impl<'a> ParallelExtend<Cow<'a, str>> for String
[src]
Extend a string with string slices from a parallel iterator.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = Cow<'a, str>>,
[src]
I: IntoParallelIterator<Item = Cow<'a, str>>,
impl<L, R, T> ParallelExtend<T> for Either<L, R> where
L: ParallelExtend<T>,
R: ParallelExtend<T>,
T: Send,
[src]
L: ParallelExtend<T>,
R: ParallelExtend<T>,
T: Send,
Either<L, R>
can be extended if both L
and R
are parallel extendable.
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
[src]
I: IntoParallelIterator<Item = T>,