Map Doubles
Use .iter() and .map() to double every number in vec![1, 2, 3, 4, 5]. Collect the results into a new Vec<i32> and print it.
Expected output:
text
[2, 4, 6, 8, 10]
Hints:
- Use
.iter().map(|x| x * 2).collect() - You need a type annotation:
let doubled: Vec<i32> = ... - Print with
{:?}
rust
fn main() {
}