Add an example to the `cloned` method doc
@@ -260,6 +260,22 @@ pub trait ParallelIterator: Sized + Send {
/// Creates an iterator which clones all of its elements. This may be
/// useful when you have an iterator over `&T`, but you need `T`.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use rayon::prelude::*;
+ ///
+ /// let a = [1, 2, 3];
+ ///
+ /// let v_cloned: Vec<_> = a.par_iter().cloned().collect();
+ ///
+ /// // cloned is the same as .map(|&x| x), for integers
+ /// let v_map: Vec<_> = a.par_iter().map(|&x| x).collect();
+ ///
+ /// assert_eq!(v_cloned, vec![1, 2, 3]);
+ /// assert_eq!(v_map, vec![1, 2, 3]);
+ /// ```
fn cloned<'a, T>(self) -> Cloned<Self>
where T: 'a + Clone + Send,
Self: ParallelIterator<Item = &'a T>
