Smart Pointers & Interior Mutability
Smart pointers combine ownership with pointer-like behavior, while interior mutability provides controlled mutation through shared references.
Concepts
Patterns
Antipatterns
Neighboring Notes
Ownership · Borrowing · The Drop Trait · Arc · Shared State with Mutex · Deref Polymorphism Antipattern · Rc RefCell Overuse
Sources
- The Rust Programming Language, ch. 15 “Smart Pointers” - the-book, https://doc.rust-lang.org/book/ch15-00-smart-pointers.html
- Standard library,
std::boxed,std::cell,std::rc, andstd::borrow::Cow- std, https://doc.rust-lang.org/std/boxed/struct.Box.html https://doc.rust-lang.org/std/cell/index.html https://doc.rust-lang.org/std/rc/index.html https://doc.rust-lang.org/std/borrow/enum.Cow.html
