constrain WorldQuery::init_state argument to ComponentInitializer#13442
Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom May 30, 2024
Merged
constrain WorldQuery::init_state argument to ComponentInitializer#13442alice-i-cecile merged 1 commit intobevyengine:mainfrom
alice-i-cecile merged 1 commit intobevyengine:mainfrom
Conversation
0297458 to
6e848a5
Compare
alice-i-cecile
approved these changes
May 22, 2024
6e848a5 to
130df8e
Compare
jdm
approved these changes
May 30, 2024
Contributor
jdm
left a comment
There was a problem hiding this comment.
This solution makes sense to me!
hymm
added a commit
to hymm/bevy
that referenced
this pull request
Jun 11, 2024
…izer (bevyengine#13442)" This reverts commit 5cfb063.
hymm
added a commit
to hymm/bevy
that referenced
this pull request
Jun 11, 2024
…izer (bevyengine#13442)" This reverts commit 5cfb063.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 11, 2024
#13804) …izer (#13442)" This reverts commit 5cfb063. - This PR broke bevy-trait-query, which needs to be able to write a resource in init_state. See #13798 for more details. - Note this doesn't fix everything as transmutes for bevy-trait-query will still be broken,. But the current usage in that crate is UB, so we need to find another solution.
mockersf
pushed a commit
that referenced
this pull request
Jun 11, 2024
#13804) …izer (#13442)" This reverts commit 5cfb063. - This PR broke bevy-trait-query, which needs to be able to write a resource in init_state. See #13798 for more details. - Note this doesn't fix everything as transmutes for bevy-trait-query will still be broken,. But the current usage in that crate is UB, so we need to find another solution.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
In #13343,
WorldQuery::get_statewas constrained from&Worldas the argument to&Components, butWorldQuery::init_statehasn't yet been changed from&mut Worldto match.Fixes #13358
Solution
Create a wrapper around
&mut Componentsand&mut Storagesthat can be obtained from&mut Worldwith acomponent_initializermethod.This new
ComponentInitializerre-exposes the API on&mut Componentsminus the&mut Storagesparameter where it was present. For the&ComponentsAPI, it simply derefs to itscomponentsfield.Changelog
Added
The
World::component_initializermethod.The
ComponentInitializerstruct that re-exposesComponentsAPI.Changed
WorldQuery::init_statenow takes&mut ComponentInitializerinstead of&mut World.Migration Guide
Instead of passing
&mut WorldtoWorldQuery::init_statedirectly, pass in a mutable reference to the struct returned fromWorld::component_initializer.