Hi,
I am currently learning rust, which is painful process. Among others, currently trying to understand why we are using Rc,RefCell
and other goodies.
I encountered such example (last example from std::rc - Rust):
fn main() {
//snip
// Add the `Gadget`s to their `Owner`.
{
let mut gadgets = gadget_owner.gadgets.borrow_mut();
gadgets.push(Rc::downgrade(&gadget1));
gadgets.push(Rc::downgrade(&gadget2));
// `RefCell` dynamic borrow ends here.
}
// snip
}
My question is:
- is it common practice in Rust production grade code to open new block just to
borrow_mut()
something?
If the question doesn't make sense, sorry for inconvinience - still learning....