From 878cdac996e9ed14fe68ce235bf9fa3f2d2d0b5f Mon Sep 17 00:00:00 2001 From: ehlxr Date: Wed, 26 Aug 2020 15:51:08 +0800 Subject: [PATCH] update at 2020-08-26 15:51:08 by ehlxr --- src/main.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index dbc31b8..e9d7aab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -331,19 +331,27 @@ fn main() { println!("{:?}", in_my_size); let counter = Counter::new(); - let v: Vec<_> = counter.into_iter().map(|x| x + 1).collect(); + let v: Vec<_> = counter.into_iter().map(|x| x).collect(); println!("{:?}", v); let v: Vec<_> = Counter::new() .zip(Counter::new().skip(1)) - .map(|(a, b)| a * b) + .map(|(a, b)| a) .collect(); - println!("{:?}", v); + println!("Counter zip map: {:?}", v); let sum: u32 = Counter::new() .zip(Counter::new().skip(1)) .map(|(a, b)| a * b) - .filter(|x| x % 3 == 0) + // .filter(|x| x % 3 == 0) .sum(); - println!("{}", sum); + println!("Counter sum: {}", sum); + let mut zip = Counter::new().zip(Counter::new()); + + println!("{:?}",zip.next().unwrap()); + println!("{:?}",zip.next().unwrap()); + println!("{:?}",zip.next().unwrap()); + println!("{:?}",zip.next().unwrap()); + println!("{:?}",zip.next().unwrap()); + println!("{:?}",zip.next().); // --------------------------- println!("----------------------------------------");