Trait heron::rapier_plugin::rapier::rayon::iter::ParallelDrainFull [−][src]
ParallelDrainFull
creates a parallel iterator that moves all items
from a collection while retaining the original capacity.
Types which are indexable typically implement ParallelDrainRange
instead, where you can drain fully with par_drain(..)
.
Associated Types
type Iter: ParallelIterator
[src]
The draining parallel iterator type that will be created.
type Item: Send
[src]
The type of item that the parallel iterator will produce.
This is usually the same as IntoParallelIterator::Item
.
Required methods
pub fn par_drain(self) -> Self::Iter
[src]
Returns a draining parallel iterator over an entire collection.
When the iterator is dropped, all items are removed, even if the
iterator was not fully consumed. If the iterator is leaked, for example
using std::mem::forget
, it is unspecified how many items are removed.
Examples
use rayon::prelude::*; use std::collections::{BinaryHeap, HashSet}; let squares: HashSet<i32> = (0..10).map(|x| x * x).collect(); let mut heap: BinaryHeap<_> = squares.iter().copied().collect(); assert_eq!( // heaps are drained in arbitrary order heap.par_drain() .inspect(|x| assert!(squares.contains(x))) .count(), squares.len(), ); assert!(heap.is_empty()); assert!(heap.capacity() >= squares.len());
Implementations on Foreign Types
impl<'a, T> ParallelDrainFull for &'a mut BinaryHeap<T> where
T: Ord + Send,
[src]
T: Ord + Send,
type Iter = Drain<'a, T>
type Item = T
pub fn par_drain(self) -> <&'a mut BinaryHeap<T> as ParallelDrainFull>::Iter
[src]
impl<'a, K, V, S> ParallelDrainFull for &'a mut HashMap<K, V, S> where
K: Eq + Send + Hash,
V: Send,
S: BuildHasher,
[src]
K: Eq + Send + Hash,
V: Send,
S: BuildHasher,
type Iter = Drain<'a, K, V>
type Item = (K, V)
pub fn par_drain(self) -> <&'a mut HashMap<K, V, S> as ParallelDrainFull>::Iter
[src]
impl<'a, T, S> ParallelDrainFull for &'a mut HashSet<T, S> where
T: Eq + Send + Hash,
S: BuildHasher,
[src]
T: Eq + Send + Hash,
S: BuildHasher,