Right, I agree. To me that is a "const-correctness" problem with the API of Deref
and DerefMut
. The problem is that dereferencing RefMut
requires &mut self
rather than a weaker and more accurate &uniq self
. It would be ideal if Rust had &uniq
for unique, non-mutable references, and a corresponding DerefUniq
.
2 Likes