-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ReflectKind
#11664
Add ReflectKind
#11664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this: there's clearly a need for this information, as shown by our own duplicated error type.
That said, this is technically breaking, and needs a migration guide.
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
While yes this is technically breaking compared to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes are great and can very easily improve the code quality with reflection in the future.
@pablo-lua, if you're comfortable, feel free to leave a full Approval :) Like we talk about in CONTRIBUTING.md, community approvals are really vital for Bevy! |
Great, will do that :) |
Objective
Fix #11657
Solution
Add a
ReflectKind
enum, addReflect::reflect_kind
which returns aReflectKind
, and addkind
method implementions toReflectRef
,ReflectMut
, andReflectOwned
, which returns aReflectKind
.I also changed
AccessError
to use this new struct instead of it's ownTypeKind
struct.Changelog
ReflectKind
, an enumeration over the kinds of a reflected type without its data.Reflect::reflect_kind
(with default implementation)kind
method onReflectRef
,ReflectMut
, andReflectOwned
which gives their kind without any information, as aReflectKind