diff options
author | Stefan Kreutz <mail@skreutz.com> | 2023-03-25 17:26:38 +0100 |
---|---|---|
committer | Stefan Kreutz <mail@skreutz.com> | 2023-03-25 17:26:38 +0100 |
commit | a168653d083e797274a14f20fbc0d37fad2ed601 (patch) | |
tree | 2355f66e69e2fbe4b83b87b918fca5cd5f94bacb | |
parent | fb71e0c7dbcd5deef8279dfc98b1d74bec1f094b (diff) | |
download | parseq-a168653d083e797274a14f20fbc0d37fad2ed601.tar |
Revise crate-level example
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | src/lib.rs | 11 |
2 files changed, 7 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 548607b..6a2a17f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep A Changelog][] and this project adheres to - Implemented `Iterator::size_hint` for `ParallelMap` - Implemented `FusedIterator` for `ParallelMap` - Implemented `ExactSizeIterator` for `ParallelMap` +- Revised crate-level example ## [0.1.1] - 2022-12-21 @@ -9,15 +9,16 @@ //! use std::time::Duration; //! use parseq::ParallelIterator; //! -//! let mut iter = (0..3) +//! let mut iter = [3,2,1] +//! .into_iter() //! .map_parallel(|i| { //! // Insert heavy computation here ... -//! 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); //! ``` |