2 ms·
> I wish exist a super-charged RcRefCell that is "blessed" by the rust team as is with Rc The syntax for that is Rc<RefCell<…>> and yes, this is clearly intend
by zozbot234 6y ago
> I wish exist a super-charged RcRefCell that is "blessed" by the rust team as is with Rc
The syntax for that is Rc<RefCell<…>> and yes, this is clearly intended. The idea is that Rc is limited to managing multiple owners, while the RefCell part deals with shared mutability.
- steveklabnik 6y agoLong ago, we did have those as one type: https://doc.rust-lang.org/0.5/std/arc.html#struct-mutexarc https://doc.rust-lang.org/0.5/std/arc.html#struct-mutexarc But yes, as you say, we decided to split them up, because it is easy to combine them, and you may want to combine other pieces in different ways. Rc<T> on its own is good in many cases, you may want Arc<RwLock<T>> instead of Arc<Mutex<T>>, etc.