Box<T> — single owner, heap allocation. Rc<T> — reference counting, multiple owners.
Box<T>:
Rc<T>:
1// Box2let b = Box::new(5);3let b2 = b; // Moved4// println!("{}", b); // Error56// Rc7use std::rc::Rc;8let a = Rc::new(5);9let b = Rc::clone(&a); // Cloned10println!("{}", a); // OK11println!("{}", b); // OK
Key: Box for single ownership, Rc for shared.