Closed vultix closed 1 month ago
I'm not familiar with OwningRef, but rust has a limitation that makes it impossible to both implement Copy
and Drop
at the same time. To safely implement Deref
, Ref
s need to hold a lock that prevents other RefMut
s from accessing the data at the same time. To release that lock when you are done using the Ref
, you need to implement Drop
.
Because of this I don't think it is possible to implement both Copy
and Deref
on Signal. (RefRef in the OwningRef crate implements Drop so it cannot implement Copy
)
Feature Request
I believe it should be possible using the owning-ref crate to directly implement Deref and DerefMut for Signal, allowing code like
signal.mutate()
instead ofsignal.write().mutate()
This will be a huge ergonomic win if we can get it to work!