Skip to content
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

Merged
merged 4 commits into from
Feb 7, 2024
Merged

Add ReflectKind #11664

merged 4 commits into from
Feb 7, 2024

Conversation

doonv
Copy link
Contributor

@doonv doonv commented Feb 2, 2024

Objective

Fix #11657

Solution

Add a ReflectKind enum, add Reflect::reflect_kind which returns a ReflectKind, and add kind method implementions to ReflectRef, ReflectMut, and ReflectOwned, which returns a ReflectKind.

I also changed AccessError to use this new struct instead of it's own TypeKind struct.


Changelog

  • Added ReflectKind, an enumeration over the kinds of a reflected type without its data.
  • Added Reflect::reflect_kind (with default implementation)
  • Added implementation for the kind method on ReflectRef, ReflectMut, and ReflectOwned which gives their kind without any information, as a ReflectKind

@doonv doonv changed the title Add reflect kind Add ReflectKind Feb 2, 2024
@alice-i-cecile alice-i-cecile added C-Enhancement A new feature A-Reflection Runtime information about types labels Feb 2, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a 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.

@alice-i-cecile alice-i-cecile added the C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide label Feb 3, 2024
Copy link
Contributor

github-actions bot commented Feb 3, 2024

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?
It will be used to help writing the migration guide for the version. Putting it after a ## Migration Guide will help it get automatically picked up by our tooling.

@doonv
Copy link
Contributor Author

doonv commented Feb 3, 2024

While yes this is technically breaking compared to main, it's not breaking when compared to 0.12, so I don't think a migration guide is necessary.

@alice-i-cecile alice-i-cecile removed the C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide label Feb 3, 2024
Copy link
Contributor

@pablo-lua pablo-lua left a 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.

@alice-i-cecile
Copy link
Member

@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!

@pablo-lua
Copy link
Contributor

Great, will do that :)

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 7, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Feb 7, 2024
Merged via the queue into bevyengine:main with commit 054134f Feb 7, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Enhancement A new feature S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReflectKind struct
3 participants