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
Right now the crate contains a bunch of types and typedefs for different mutabilty and usecase scenarios.
It would be nice if the API could be simplified by offloading some of the duplication and different behaviors to type paramers instead.
Possible refactors:
Anything using the Erased trait should be made generic over the actual trait, to support varitions like Erased+Send or Erased+Sync
This especially includes the *Ref type defs
OwningRef and OwningRefMut are potentially mergeable by adding a type parameter for the mutabilty: OwningRef<*const T> and OwningRef<*mut T>. Or with specially defined marker types: OwningRef<Shared> and OwningRef<Mutable>.
OwningRef might possibly be implemented in terms of an OwningHandle.
The text was updated successfully, but these errors were encountered:
I don't think it's useful to try to merge OwningRef and OwningRefMut, since Rust doesn't provide any good way to abstract over mutability. Even if you try, you'll run into the issue that methods have to change receiver type (&self vs &mut self)
Right now the crate contains a bunch of types and typedefs for different mutabilty and usecase scenarios.
It would be nice if the API could be simplified by offloading some of the duplication and different behaviors to type paramers instead.
Possible refactors:
Erased
trait should be made generic over the actual trait, to support varitions likeErased+Send
orErased+Sync
*Ref
type defsOwningRef
andOwningRefMut
are potentially mergeable by adding a type parameter for the mutabilty:OwningRef<*const T>
andOwningRef<*mut T>
. Or with specially defined marker types:OwningRef<Shared>
andOwningRef<Mutable>
.OwningRef
might possibly be implemented in terms of anOwningHandle
.The text was updated successfully, but these errors were encountered: