Rust Tutorial #13: Smart Pointers — Box, Rc, Arc
In the previous tutorial, we learned closures and iterators. Now we learn smart pointers — types that act like pointers but have extra capabilities. In Rust, the most common pointer is a reference (&T). References borrow data but do not own it. Smart pointers own the data they point to. They also add features like heap allocation, reference counting, and interior mutability. What Is a Smart Pointer? A smart pointer is a struct that: ...