usually if you have to resort to
RefCell<T>
, it means something is wrong with your architecture2023-10-10 using
RefCell
has a few disadvantages2023-10-10 second, your program can now panic in unexpected places, because it turns out runtime borrows can be really hard to predict
2023-10-10 as evidenced by a random crash I once got while using druid which was caused by a overlapping mutable then immutable borrows at runtime
2023-10-10
fourth, and this one is extremely easy to spot - your code becomes really verbose!
2023-10-10 and you end up with lots of temporaries because of the
Ref<'b, T>
guards you have to keep in scope.2023-10-10