Iteration with `.iter()` gives references. If you want the elements by value, then you need to dereference or clone them, or use `.into_iter()` instead.
vec.iter().map(|x| /* x is a reference (a pointer) */)
vec.iter().map(|&x| /* x is a value */)
vec.iter().cloned().map(|x| /* x is a value */)
BTW: in closure arguments `&` may seem backwards, because that's a pattern, not a type. The syntax for args is |pattern:type|.
See how it works with `for … in`: https://is.gd/qo9fVj
@rust The more time I spend apart from #Rust, the more I wished I used it. Then I inevitably try writing it and remember that even simply copying things requires jumping through hoops. I really want to like it, and maybe eventually I'll spend enough time with it and see the light, but until then, back to #golang.
https://octodon.social/media/SPSm-pG6chSjE5QnvU0