Closed davidpdrsn closed 1 year ago
I'm not sure we really need this after all. The use case we had internally turned out to be solvable in a different way (EntityId::invalid()
). So since we don't need it and its unlikely there is a good way to solve it I think I'll close this for now.
We have a use case where it would be useful to pass data into
FromReflect
which is needed to perform the conversion: We have entity ids encoded as opaqueu32
s. Before converting au32
back into an entity id we'd need to check that it actually points to a valid entity, or perhaps do additional checks. Doing that check would require a handle to the system that manages entities. It is currently not possible to pass that intofrom_reflect
and we only get the rawu32
.We can't simply add a new argument for
from_reflect
......since
from_reflect
called from:[T; N]::clone_reflect
EnumValue::patch
BTreeMap::insert
BTreeMap::remove
BTreeMap::clone_reflect
Vec::clone_reflect
Vec::push
patch
So we'd have to also pass the new arg to those functions. We also cannot add generic parameters to those functions since
Reflect
needs to be object safe. Could makeReflect
itself generic over the context but thats a large change that'd cause other changes pretty much everywhere.Perhaps there is a more elegant solution that wouldn't require changing everything 🤔