You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'd be nice if OwningRefMut could share ownership through Arc, but turns out that doesn't really work because it would cause safety issues due to the presence of .owner() :(
Here's what I wanted to implement for OwningRefMut:
But this is not safe, because you could use owner() of OwningRefMut<O, U> to get an immutable reference while holding a mutable reference from the OwningRefMut<O, V>.
This means the API would have to be limited to something like Arc<Erased>, from which you can't take extract any immutable references.
Edit: My current workaround is to wrap the inner object inside an opaque wrapper to prevent the user from acquiring any references from it: Rufflewind@e9ab08f
The text was updated successfully, but these errors were encountered:
It'd be nice if
OwningRefMut
could share ownership throughArc
, but turns out that doesn't really work because it would cause safety issues due to the presence of.owner()
:(Here's what I wanted to implement for
OwningRefMut
:But this is not safe, because you could use
owner()
ofOwningRefMut<O, U>
to get an immutable reference while holding a mutable reference from theOwningRefMut<O, V>
.This means the API would have to be limited to something like
Arc<Erased>
, from which you can't take extract any immutable references.Edit: My current workaround is to wrap the inner object inside an opaque wrapper to prevent the user from acquiring any references from it: Rufflewind@e9ab08f
The text was updated successfully, but these errors were encountered: