When doing pattern matching or destructuring via let binding, the ref keyword can be used to take references to the field of a struct/tuple.
A ref borrow on the left side of an assignment is equivalent to an & borrow on the right side.
1 | fn main() { |
Destructuring a struct:
1 | struct Point { |