References can be converted into a more primitive type called a raw pointer. Much like a number, it can be copied and moved around with little restriction. Rust makes no assurances of the validity of the memory location it points to.
Two kinds of raw pointers exist:
*const T
- A raw pointer to data of type T that should never change.*mut T
- A raw pointer to data of type T that can change.Raw pointers can be converted to and from numbers (e.g. usize
).
Raw pointers can access data with unsafe code (more on this later).
Memory Details: