From references-change-permissions-on-places, places have three kinds of permission on their data:
Read (R): data can be copied to another location.
Write (W): data can be mutated.
Own (O): data can be moved or dropped.
In the example
fn main() {
let mut v: Vec = vec![1, 2, 3];
let num: &i32 = &v[2];
println!("Third element is {}", *num);
v.push(4);
}
From the third line, reference num gain permissions R and O but no W since it was not marked as let mut .
What can we do if a reference have permissions R and O?
I know that reference do not own its data, so how to read its data? Also, how to move a reference?