You have two slightly different questions.
You can create mutable binding by saying mut twice:
fn main() { let a = (1, 2); let (mut b, mut c) = a; b += 1; c += 2; println!("{}, {}", b, c); }
But to change it in the original tuple, you will need a volatile link to this tuple:
fn main() { let mut a = (1, 2); { let (ref mut b, ref mut c) = a; *b += 1; *c += 2;
Shepmaster
source share