summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 1359ec6..f71965b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -72,14 +72,16 @@ pub trait ParallelIterator {
/// use std::time::Duration;
/// use parseq::ParallelIterator;
///
- /// let mut iter = (0..3)
+ /// let mut iter = [3,2,1]
+ /// .into_iter()
/// .map_parallel(|i| {
- /// std::thread::sleep(Duration::from_millis((i % 3) * 10));
- /// i
+ /// // Insert heavy computation here ...
+ /// std::thread::sleep(Duration::from_millis(100*i));
+ /// 2*i
/// });
///
- /// assert_eq!(iter.next(), Some(0));
- /// assert_eq!(iter.next(), Some(1));
+ /// assert_eq!(iter.next(), Some(6));
+ /// assert_eq!(iter.next(), Some(4));
/// assert_eq!(iter.next(), Some(2));
/// assert_eq!(iter.next(), None);
/// ```
@@ -119,14 +121,15 @@ pub trait ParallelIterator {
/// use std::time::Duration;
/// use parseq::ParallelIterator;
///
- /// let mut iter = (0..3)
+ /// let mut iter = [3,2,1]
+ /// .into_iter()
/// .map_parallel_limit(2, 16, |i| {
- /// std::thread::sleep(Duration::from_millis((i % 3) * 10));
- /// i
+ /// std::thread::sleep(Duration::from_millis(100*i));
+ /// 2*i
/// });
///
- /// assert_eq!(iter.next(), Some(0));
- /// assert_eq!(iter.next(), Some(1));
+ /// assert_eq!(iter.next(), Some(6));
+ /// assert_eq!(iter.next(), Some(4));
/// assert_eq!(iter.next(), Some(2));
/// assert_eq!(iter.next(), None);
/// ```
Generated by cgit. See skreutz.com for my tech blog and contact information.