Based on Matrix discussions, I think I understand why the current Mutex API was chosen. However, using Mutex<RefCell<T>> is a bit more painful than I think it could be. Would it be possible to add an inherent block for Mutex<RefCell<T>>? It would basically combine .borrow(cs) with some of RefCell's methods, so that you don't end up with things like .borrow(cs).borrow_mut().
I can make a PR, but first I wanted to see if it would be a non-starter for some reason. It wouldn't be breaking, right?
Interesting idea! I don't think it would be breaking and it would be interesting to see what a proof of concept would look like. Certainly Mutex<RefCell> is a really common use-case so making it easier to use would be nice.
Based on Matrix discussions, I think I understand why the current
Mutex
API was chosen. However, usingMutex<RefCell<T>>
is a bit more painful than I think it could be. Would it be possible to add an inherent block forMutex<RefCell<T>>
? It would basically combine.borrow(cs)
with some ofRefCell
's methods, so that you don't end up with things like.borrow(cs).borrow_mut()
.I can make a PR, but first I wanted to see if it would be a non-starter for some reason. It wouldn't be breaking, right?