diff --git a/src/trait/impl_trait.md b/src/trait/impl_trait.md index 7b87bd2e9c..f429d9adf7 100644 --- a/src/trait/impl_trait.md +++ b/src/trait/impl_trait.md @@ -68,4 +68,10 @@ fn double_positives<'a>(numbers: &'a Vec) -> impl Iterator + '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![4, 6]); +} ```