Skip to content

Commit

Permalink
Merge pull request #1465 from mautamu/patch-1
Browse files Browse the repository at this point in the history
Close #1464
  • Loading branch information
marioidival authored Oct 1, 2021
2 parents 724aecc + 5030b35 commit 111e468
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/trait/impl_trait.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ fn double_positives<'a>(numbers: &'a Vec<i32>) -> impl Iterator<Item = i32> + 'a
.filter(|x| x > &&0)
.map(|x| x * 2)
}
fn main() {
let singles = vec![-3, -2, 2, 3];
let doubles = double_positives(&singles);
assert_eq!(doubles.collect::<Vec<i32>>(), vec![4, 6]);
}
```

0 comments on commit 111e468

Please sign in to comment.