3 ms·
Yes, the idea is that you only create them temporarily. Mutability is also possible to some extent with these "smart" pointers. It gets a bit trickier and less
by idubrov 8y ago
Yes, the idea is that you only create them temporarily.
Mutability is also possible to some extent with these "smart" pointers. It gets a bit trickier and less ergonomic, though. See https://play.rust-lang.org/?gist=fbf1c24397e7020c95774bf09060b6fd&version=stable&mode=debug&edition=2015 https://play.rust-lang.org/?gist=fbf1c24397e7020c95774bf0906...
Another option would be to store something like "Rc<RefCell<Container>>" instead of "&'a mut Container", in which case you will be able to achieve something that behaves like multiple mutable references (with all the concurrency issues of them).