OwningPtr should impl From<Box<T>> #13287
Labels
A-Pointers
Relating to Bevy pointer abstractions
A-Reflection
Runtime information about types
C-Enhancement
A new feature
D-Modest
A "normal" level of difficulty; suitable for simple features or challenging fixes
X-Uncontroversial
This work is generally agreed upon
What problem does this solve or what need does it fill?
I am trying to copy the value for a type erased entity component of type
&dyn Reflect
.insert_by_id
requires anOwningPtr
to be passed in. I want to copy the component&dyn Reflect
points to and insert the same component for an entity. I can copy the value of&dyn Reflect
viaclone_value()
giving meBox<dyn Reflect>
.There isn't an easy way to get an OwningPtr from a Box. A Box is a unique pointer to some value on the heap - I don't see any reason why it can't be an OwningPtr.
What solution would you like?
implement
From<Box<T>>
forOwningPtr
.What alternative(s) have you considered?
This can be done with raw pointers.
Additional context
The text was updated successfully, but these errors were encountered: