Smart Pointers
Heap allocation, shared ownership, interior mutability, and borrowed data abstractions.
Box<T> | Heap allocation, trait objects, recursive types |
Rc<T> / Arc<T> | Shared ownership — single-threaded vs multi-threaded |
Cell<T> / RefCell<T> | Interior mutability — no borrow checker cost at compile time |
Cow<'a, B> | Clone-on-write — avoid cloning borrowed data |
Pin<P> | Prevent value from being moved — required for self-referential futures |