12 ms·
> you can only take one &mut reference at a time. You can have as many immutable `&` references as you want There's another small detail: these two cases are m
by cesarb 8y ago
> you can only take one &mut reference at a time. You can have as many immutable `&` references as you want
There's another small detail: these two cases are mutually exclusive. You can either have one &mut reference, or as many & references as you want. This means that code receiving a & reference can be sure the object won't change, and that code receiving a &mut reference knows the object can be modified safely since nothing else could be looking at it. (Assuming the object doesn't contain a Cell, the rules are a bit different when a Cell is involved.)