Skip to content

Add ReflectKind#11664

Merged
alice-i-cecile merged 4 commits intobevyengine:mainfrom
doonv:add-reflect-kind
Feb 7, 2024
Merged

Add ReflectKind#11664
alice-i-cecile merged 4 commits intobevyengine:mainfrom
doonv:add-reflect-kind

Conversation

@doonv
Copy link
Copy Markdown
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-Feature A new feature, making something new possible A-Reflection Runtime information about types labels Feb 2, 2024
Copy link
Copy Markdown
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 M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Feb 3, 2024
@github-actions
Copy link
Copy Markdown
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
Copy Markdown
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 M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Feb 3, 2024
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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-Feature A new feature, making something new possible 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