-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Remove States::variants and remove enum-only restriction its derive #9945
Conversation
Something to consider is whether to remove the derive macro entirely, and blanket implement |
I don't think we should, at least not in this PR. The explicitness of the trait has its upsides and this PR is not currently controversial. |
I agree we keep the |
271ba55
to
68a5aba
Compare
I'm going to link #9957 here because it's something we'll want to look into merging once this is in -- it adds the ability to match on state patterns in run conditions and transition schedules. Definitely something we want if we're allowing "anything can be a state" |
I do want to add that I think having the derive is very useful - for a couple of reasons: a) even with all the changes here and in my PR, states still need to be |
…evyengine#9945) # Objective The `States::variants` method was once used to construct `OnExit` and `OnEnter` schedules for every possible value of a given `States` type. [Since the switch to lazily initialized schedules](https://github.com/bevyengine/bevy/pull/8028/files#diff-b2fba3a0c86e496085ce7f0e3f1de5960cb754c7d215ed0f087aa556e529f97f), we no longer need to track every possible value. This also opens the door to `States` types that aren't enums. ## Solution - Remove the unused `States::variants` method and its associated type. - Remove the enum-only restriction on derived States types. --- ## Changelog - Removed `States::variants` and its associated type. - Derived `States` can now be datatypes other than enums. ## Migration Guide - `States::variants` no longer exists. If you relied on this function, consider using a library that provides enum iterators.
…evyengine#9945) # Objective The `States::variants` method was once used to construct `OnExit` and `OnEnter` schedules for every possible value of a given `States` type. [Since the switch to lazily initialized schedules](https://github.com/bevyengine/bevy/pull/8028/files#diff-b2fba3a0c86e496085ce7f0e3f1de5960cb754c7d215ed0f087aa556e529f97f), we no longer need to track every possible value. This also opens the door to `States` types that aren't enums. ## Solution - Remove the unused `States::variants` method and its associated type. - Remove the enum-only restriction on derived States types. --- ## Changelog - Removed `States::variants` and its associated type. - Derived `States` can now be datatypes other than enums. ## Migration Guide - `States::variants` no longer exists. If you relied on this function, consider using a library that provides enum iterators.
Objective
The
States::variants
method was once used to constructOnExit
andOnEnter
schedules for every possible value of a givenStates
type. Since the switch to lazily initialized schedules, we no longer need to track every possible value.This also opens the door to
States
types that aren't enums.Solution
States::variants
method and its associated type.Changelog
States::variants
and its associated type.States
can now be datatypes other than enums.Migration Guide
States::variants
no longer exists. If you relied on this function, consider using a library that provides enum iterators.