|
|
@@ -9,6 +9,7 @@ use crate::{ |
|
|
cloned::Cloned, |
|
|
cloned::Cloned, |
|
|
collect::Collect, |
|
|
collect::Collect, |
|
|
copied::Copied, |
|
|
copied::Copied, |
|
|
|
|
|
count::Count, |
|
|
filter::Filter, |
|
|
filter::Filter, |
|
|
filter_map::FilterMap, |
|
|
filter_map::FilterMap, |
|
|
flatten::{FlatMapIter, FlattenIter}, |
|
|
flatten::{FlatMapIter, FlattenIter}, |
|
|
@@ -290,6 +291,21 @@ pub trait ParallelIterator<'a>: Sized + Send { |
|
|
TryForEachInit::new(self, init, operation) |
|
|
TryForEachInit::new(self, init, operation) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Counts the number of items in this parallel iterator. |
|
|
|
|
|
/// |
|
|
|
|
|
/// # Examples |
|
|
|
|
|
/// |
|
|
|
|
|
/// ``` |
|
|
|
|
|
/// use rayon::prelude::*; |
|
|
|
|
|
/// |
|
|
|
|
|
/// let count = (0..100).into_par_iter().count(); |
|
|
|
|
|
/// |
|
|
|
|
|
/// assert_eq!(count, 100); |
|
|
|
|
|
/// ``` |
|
|
|
|
|
fn count(self) -> Count<Self> { |
|
|
|
|
|
Count::new(self) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// Applies `operation` to each item of this iterator, producing a new |
|
|
/// Applies `operation` to each item of this iterator, producing a new |
|
|
/// iterator with the results. |
|
|
/// iterator with the results. |
|
|
/// |
|
|
/// |
|
|
|