Problem of understanding usage of Rc<RefCell> in Rust
well…I’m working with some code that uses Rc<RefCell<SomeStruct>>
, and I’d like to understand its behavior better. Here’s what I know so far:
first, Rc
provides shared ownership, allowing multiple references to the same data…
and RefCell
provides interior mutability, allowing runtime-checked mutable borrows even behind immutable references…
i tried to run this code: