I tried:
fn main() {
let mut vec = [1, 2, 3];
for mut x in &vec { *x = 3; }
for mut &x in &vec { x = 3; }
for mut *x in &vec { x = 3; }
for mut x in mut &vec { *x = 3; }
for mut x in &(mut vec) { *x = 3; }
}
None of these work; how should I do it?
I get errors like:
mutmust be attached to each individual binding- expected identifier, found
*- expected expression, found keyword
mut- cannot assign to
*xwhich is behind a&reference