4 ms·
For the read-only case it's the same except for a larger overhead of the cloning. But for the case where the data is modified, Rc often goes with RefCell as Rc
by Klasiaster 5y ago
For the read-only case it's the same except for a larger overhead of the cloning.
But for the case where the data is modified, Rc often goes with RefCell as Rc<RefCell<X>> and allows in-place mutation called interior mutability. This means that the other code that got the copy of the Rc will observe the write effects.