| @@ -0,0 +1,32 @@ | |||||
| use std::collections::BinaryHeap; | |||||
| use std::iter::FromIterator; | |||||
| use crate::IntoParallelIterator; | |||||
| impl<'a, I> IntoParallelIterator<'a> for BinaryHeap<I> | |||||
| where | |||||
| I: Send + 'a, | |||||
| { | |||||
| type Iter = <Vec<I> as IntoParallelIterator<'a>>::Iter; | |||||
| type Item = I; | |||||
| fn into_par_iter(self) -> Self::Iter { | |||||
| let vec = Vec::from_iter(self); | |||||
| vec.into_par_iter() | |||||
| } | |||||
| } | |||||
| impl<'a, I> IntoParallelIterator<'a> for &'a BinaryHeap<I> | |||||
| where | |||||
| I: Send + Sync + 'a, | |||||
| { | |||||
| type Iter = <Vec<&'a I> as IntoParallelIterator<'a>>::Iter; | |||||
| type Item = &'a I; | |||||
| fn into_par_iter(self) -> Self::Iter { | |||||
| let vec = Vec::<&'a I>::from_iter(self); | |||||
| vec.into_par_iter() | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,35 @@ | |||||
| use std::collections::HashSet; | |||||
| use std::hash::BuildHasher; | |||||
| use std::iter::FromIterator; | |||||
| use crate::IntoParallelIterator; | |||||
| impl<'a, I, S> IntoParallelIterator<'a> for HashSet<I, S> | |||||
| where | |||||
| I: Send + 'a, | |||||
| S: BuildHasher, | |||||
| { | |||||
| type Iter = <Vec<I> as IntoParallelIterator<'a>>::Iter; | |||||
| type Item = I; | |||||
| fn into_par_iter(self) -> Self::Iter { | |||||
| let vec = Vec::from_iter(self); | |||||
| vec.into_par_iter() | |||||
| } | |||||
| } | |||||
| impl<'a, I, S> IntoParallelIterator<'a> for &'a HashSet<I, S> | |||||
| where | |||||
| I: Send + Sync + 'a, | |||||
| S: BuildHasher, | |||||
| { | |||||
| type Iter = <Vec<&'a I> as IntoParallelIterator<'a>>::Iter; | |||||
| type Item = &'a I; | |||||
| fn into_par_iter(self) -> Self::Iter { | |||||
| let vec = Vec::<&'a I>::from_iter(self); | |||||
| vec.into_par_iter() | |||||
| } | |||||
| } | |||||
| @@ -1,3 +1,5 @@ | |||||
| mod binary_heap; | |||||
| mod hash_set; | |||||
| mod range; | mod range; | ||||
| mod slice; | mod slice; | ||||
| mod vec; | mod vec; | ||||
| @@ -13,11 +13,7 @@ use crate::{ | |||||
| WithIndexedProducer, WithProducer, WithSetup, | WithIndexedProducer, WithProducer, WithSetup, | ||||
| }; | }; | ||||
| /// Parallel iterator that moves out of a vector. | |||||
| #[derive(Debug, Clone)] | |||||
| pub struct IntoIter<T> { | |||||
| vec: Vec<T>, | |||||
| } | |||||
| /* Vec */ | |||||
| impl<'a, T> IntoParallelIterator<'a> for Vec<T> | impl<'a, T> IntoParallelIterator<'a> for Vec<T> | ||||
| where | where | ||||
| @@ -94,6 +90,11 @@ where | |||||
| /* IntoIter */ | /* IntoIter */ | ||||
| #[derive(Debug, Clone)] | |||||
| pub struct IntoIter<T> { | |||||
| pub vec: Vec<T>, | |||||
| } | |||||
| impl<'a, T> ParallelIterator<'a> for IntoIter<T> | impl<'a, T> ParallelIterator<'a> for IntoIter<T> | ||||
| where | where | ||||
| T: Send + 'a, | T: Send + 'a, | ||||