Guest User

Untitled

a guest
May 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. use std::iter::Iterator;
  2.  
  3. // Type your code here, or load an example.
  4. pub fn square_list(nums: impl Iterator<Item = i32>) -> impl Iterator<Item = i32> {
  5. nums.map(|x| x * x)
  6. }
  7.  
  8. fn main() {
  9. println!(
  10. "{:?}",
  11. square_list(vec![1, 2, 3].into_iter()).collect::<Vec<i32>>()
  12. );
  13. }
Add Comment
Please, Sign In to add comment