|
|
|
|
|
by saghm
2649 days ago
|
|
> fn mv_mutable(mut a : MyThing) {} Compared to simply `a: MyThing`, there are two main reasons when you'd want to do this, namely a) when you want to reassign a different value to `a` or b) when you want to make a mutable reference to `a` (i.e. `&mut a`). > fn mutable_ref_mutable(mut a : &mut MyThing) {} Since you already have an `&mut MyThing`, reason "b" from above doesn't apply here, generally the only reason you'd need to do this is if you wanted to reassign a different value to `a`. Technically you would also need it if for some reason you needed an `&mut &mut MyThing`, but that isn't likely to be something you need very often. |
|