How do I convert an array of size `N`

, into another array of size `N`

(or a tuple with N elements, I don't care) by applying a function to all of the elements of the source one by one?

Here are a few solutions that I found, but I'm not really satisfied. TL; DR: I think the last one is the best one.

```
fn f(x: usize) -> usize {
x*x
}
let source = [1, 2, 3];
let destination = [
f(source[0]),
f(source[1]),
f(source[2]),
]
```

This feels very verbose and error prone.

```
let source = [1, 2, 3];
let dest: [usize; 3] = source.iter().map(|x| x*x).collect();
```

This doesn't compiles.

Using `tuples_windows`

from the `itertools`

crate.

```
use itertools::Itertools;
let source = [1, 2, 3];
let (a, b, c) = source.iter().map(|x| f(x)).tuple_windows().nth(0).unwrap();
```

This doesn't feels that much readable.

```
let source = [1, 2, 3];
let dest: [i32; 3];
for i in 0..source.len() {
dest[i] = f(source[i])
}
```

This doesn't compiles.

```
let mut dest = [0; 3];
for i in 0..source.len() {
dest[i] = f(source[i])
}
```

I think it's the best one, even if it is quite verbose.

What should I use?