I bought the book Programming Rust: Fast, Safe Systems Development 2nd Edition
a couple weeks ago to learn Rust
. At the moment, I am struggling with the topic &T
and mut &T
.
In the book, the author has mentioned the following regarding to references:
You can’t borrow a mutable reference to a read-only value.
What does it mean? An example would be nice.
>Solution :
You can’t do the following:
let a = 99;
let b = &mut a;