3 ms·
> Haven't yet written any Rust code, but aren't those two things contradicting each other? I don't think so. One way to ensure that data isn't mutated by diff
by dan00 12y ago
> Haven't yet written any Rust code, but aren't those two things contradicting each other?
I don't think so.
One way to ensure that data isn't mutated by different parts of a program,
is to have immutable data structures.
The other way - the Rust way - is to seriously track who holds mutable
references to the same data and just not allow it.
So you can have more optimized mutable data structures, but can be sure,
that if you're holding a mutable reference, that no other can modify
the data during the lifetime/scope of your mutable reference.