Shared Mutability in Rust
Summary
- For the majority of code, shared mutability is usually not required.
- We cannot have sharing, mutability and “internal consistency”. A program that tries to have all three is provably incorrect.
- If we want sharing, and mutability but do not need “internal consistency”, we can use a file, a database handle, a mutex, or any other similar structure.
- If we need mutability, and “internal consistency” but do not need sharing, we can have all modifications go through a common ancestor.