UnsafeCell
(as well as Cell
/RefCell
) has a method pub fn get_mut(&mut self) -> &mut T
, which has exactly the same signature than AsMut::as_mut
.
I've found Add non-`unsafe` `get_mut` for `UnsafeCell` and https://github.com/rust-lang/rust/pull/76936, but AsMut::as_mut
was neither mentioned in the post, nor in the PR.
Is there a reason to have a dedicated method? Would it not be simpler to implement AsMut
for cell types? May I open a PR to add AsMut
implementation? Should get_mut
be deprecated in favor of AsMut:::as_mut
For the context, I would like to also implement AsMut
for loom::cell::UnsafeCell
, see my comment in UnsafeCell::get_mut() is different from std · Issue #277 · tokio-rs/loom · GitHub