i'd avoid using C++ references to think about Rust references, they are two different things. So I'd treat & types in Rust like you would * types in C/C++, while keeping in mind the following points.
- A Rust
&type is stored as a pointer, sometimes with a length and other information (see below responses). - When you call
foo.bar(), or accessfoo.bar, rust will automatically dereference foo if it has a type of&Foo. - There is a trait called
Derefthat some smart pointer types implement, to change how the * operator works.
More details can be found in the book.