data structures that act like a pointer but also have additional metadata and capabilities.
while references only borrow data, in many cases, smart pointers own the data they point to.
smart pointers implement the Deref and Drop traits.

  • Most common
    • Box<T> for allocating values on the heap
    • Rc<T>, a reference counting type that enables multiple ownership
    • Ref<T> and RefMut<T>, accessed through RefCell<T>, a type that enforces the borrowing rules at runtime instead of compile time