Remove States::variants and remove enum-only restriction its derive#9945
Remove States::variants and remove enum-only restriction its derive#9945alice-i-cecile merged 3 commits intobevyengine:mainfrom
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::variantsmethod was once used to constructOnExitandOnEnterschedules for every possible value of a givenStatestype. Since the switch to lazily initialized schedules, we no longer need to track every possible value.This also opens the door to
Statestypes that aren't enums.Solution
States::variantsmethod and its associated type.Changelog
States::variantsand its associated type.Statescan now be datatypes other than enums.Migration Guide
States::variantsno longer exists. If you relied on this function, consider using a library that provides enum iterators.