Rust beginner notes & questions

Rust doesn't have a concept of immutable memory. All memory can be mutable in principle (that's why you can always make owned objects mutable). Only references and variable bindings have mutability attached, and temporary immutability of memory is enforced by restricting where and when these references can exist.

The closest type would be &mut &T, but I don't recall such thing being used in practice. Maybe let mut x: &T is the thing you need?

2 Likes