Przewodnik po Języku Rust Spis Treści

Combining Smart Pointers

Smart pointers might seem limited, but they can make some very powerful combinations.

Rc<Vec<Foo>> - Allow the cloning of multiple smart pointers that can borrow the same vector of immutable data structures on the heap.

Rc<RefCell<Foo>> - Allow multiple smart pointers the ability to borrow mutably/immutably the same struct Foo

Arc<Mutex<Foo>> - Allow multiple smart pointers the ability to lock temporary mutable/immutable borrows in a CPU thread exclusive manner.

Memory detail: