3 ms·
In Rust you can have as many const references to a thing as you like, but you can only have a mutable reference to a thing if there are no other references (mut
by adrianN 9y ago
In Rust you can have as many const references to a thing as you like, but you can only have a mutable reference to a thing if there are no other references (mutable or not) to the same thing. Hence it's not possible to have an iterator over a vector while trying to mutate it.
- saagarjha 9y agoAhh, so that's how it works. I wasn't quite getting how Rust's compiler was figuring this out, but I get it now.