Lesson 46 of 50
rustSmart Pointers (Box, Rc, Arc)
12 minutes
Course progress92%
Smart Pointers (Box, Rc, Arc)
Box<T>allocates data on the heap.Rc<T>provides single‑threaded reference counting.Arc<T>provides atomic reference counting for multi‑threaded scenarios.
use std::rc::Rc;
use std::sync::Arc;
fn main() {
let = ::();
= Rc::();
= Arc::();
(\