From a168653d083e797274a14f20fbc0d37fad2ed601 Mon Sep 17 00:00:00 2001 From: Stefan Kreutz Date: Sat, 25 Mar 2023 17:26:38 +0100 Subject: Revise crate-level example --- src/lib.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 3114426..1359ec6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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); //! ``` -- cgit v1.2.3