Open
Description
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 an OwningPtr
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
via clone_value()
giving me Box<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>>
for OwningPtr
.
What alternative(s) have you considered?
This can be done with raw pointers.