Implement Reflect for ParsedPath, OffsetAccess, and Access#23357
Implement Reflect for ParsedPath, OffsetAccess, and Access#23357tauanbinato wants to merge 2 commits intobevyengine:mainfrom
Conversation
|
|
||
| impl_reflect_opaque!( | ||
| (in crate::path::access) Access<'a: 'static>(Clone, Debug, Hash, PartialEq) | ||
| ); |
There was a problem hiding this comment.
Is it possible to reflect it as an Enum instead of an Opaque? Without the Enum implementation, using reflect to serialize/deserialize this will be more awkward. With the Enum implementation, everything should line up since Cow<'static, T> implements Reflect and the Serialize/Deserialize traits.
There was a problem hiding this comment.
Good point, reflecting as an Enum would be better for serialization. I went with Opaque because of the lifetime on Access<'a>, but since we already constrain it to 'static and OffsetAccess only uses Access<'static>, it should be doable. Do you think it's worth trying to derive Reflect as an enum here?
There was a problem hiding this comment.
Thanks for starting on this. Since you closed this PR, I created my own attempt at #23371. It looks like everything just worked correctly using the Reflect derive macro even with the lifetime parameter. Let me know if I missed something though.
Objective
Solution
Testing