Trait dpc_pariter::IteratorExt [−][src]
pub trait IteratorExt {
fn parallel_map<F, O>(self, f: F) -> ParallelMap<Self, O, F, ThreadPool>ⓘNotable traits for ParallelMap<I, O, F, TP>impl<I, O, F, TP> Iterator for ParallelMap<I, O, F, TP> where
I: Iterator,
I::Item: Send + 'static,
O: Send + 'static,
TP: ThreadPool,
F: FnMut(I::Item) -> O,
F: Clone + Send + 'static, type Item = O;
where
Self: Sized,
Self: Iterator,
F: FnMut(Self::Item) -> O;
fn parallel_filter<F>(self, f: F) -> ParallelFilter<Self, ThreadPool>ⓘNotable traits for ParallelFilter<I, TP>impl<I, TP> Iterator for ParallelFilter<I, TP> where
I: Iterator,
I::Item: Send + 'static,
TP: ThreadPool, type Item = I::Item;
where
Self: Sized,
Self: Iterator + Send,
F: FnMut(&Self::Item) -> bool + Send + 'static + Clone,
Self::Item: Send + 'static;
fn readahead(self, buffer_size: usize) -> Readahead<Self, ThreadPool>ⓘ
where
Self: Iterator,
Self: Sized,
Self: Send + 'static,
Self::Item: Send + 'static;
}
Expand description
Extension trait for std::iter::Iterator
bringing parallel operations
TODO
parallel_for_each
parallel_flat_map
- possibly others
PRs welcome
Required methods
fn parallel_map<F, O>(self, f: F) -> ParallelMap<Self, O, F, ThreadPool>ⓘNotable traits for ParallelMap<I, O, F, TP>impl<I, O, F, TP> Iterator for ParallelMap<I, O, F, TP> where
I: Iterator,
I::Item: Send + 'static,
O: Send + 'static,
TP: ThreadPool,
F: FnMut(I::Item) -> O,
F: Clone + Send + 'static, type Item = O;
where
Self: Sized,
Self: Iterator,
F: FnMut(Self::Item) -> O,
fn parallel_map<F, O>(self, f: F) -> ParallelMap<Self, O, F, ThreadPool>ⓘNotable traits for ParallelMap<I, O, F, TP>impl<I, O, F, TP> Iterator for ParallelMap<I, O, F, TP> where
I: Iterator,
I::Item: Send + 'static,
O: Send + 'static,
TP: ThreadPool,
F: FnMut(I::Item) -> O,
F: Clone + Send + 'static, type Item = O;
where
Self: Sized,
Self: Iterator,
F: FnMut(Self::Item) -> O,
Notable traits for ParallelMap<I, O, F, TP>
impl<I, O, F, TP> Iterator for ParallelMap<I, O, F, TP> where
I: Iterator,
I::Item: Send + 'static,
O: Send + 'static,
TP: ThreadPool,
F: FnMut(I::Item) -> O,
F: Clone + Send + 'static, type Item = O;
Run map
function in parallel on multiple threads
Results will be returned in order.
No worker threads will be started and no items will be pulled unless ParallelMap::started
was called, or until first time ParallelMap
is pulled for elements with ParallelMap::next
.
In that respect, ParallelMap
behaves like every other iterator and is lazy.
Default built-in thread pool will be used unless ParallelMap::threads
is used.
fn parallel_filter<F>(self, f: F) -> ParallelFilter<Self, ThreadPool>ⓘNotable traits for ParallelFilter<I, TP>impl<I, TP> Iterator for ParallelFilter<I, TP> where
I: Iterator,
I::Item: Send + 'static,
TP: ThreadPool, type Item = I::Item;
where
Self: Sized,
Self: Iterator + Send,
F: FnMut(&Self::Item) -> bool + Send + 'static + Clone,
Self::Item: Send + 'static,
fn parallel_filter<F>(self, f: F) -> ParallelFilter<Self, ThreadPool>ⓘNotable traits for ParallelFilter<I, TP>impl<I, TP> Iterator for ParallelFilter<I, TP> where
I: Iterator,
I::Item: Send + 'static,
TP: ThreadPool, type Item = I::Item;
where
Self: Sized,
Self: Iterator + Send,
F: FnMut(&Self::Item) -> bool + Send + 'static + Clone,
Self::Item: Send + 'static,
Notable traits for ParallelFilter<I, TP>
impl<I, TP> Iterator for ParallelFilter<I, TP> where
I: Iterator,
I::Item: Send + 'static,
TP: ThreadPool, type Item = I::Item;
Run filter
function in parallel on multiple threads
A wrapper around IteratorExt::parallel_map
really, so it has similiar properties.