-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Moved get_component(_unchecked_mut)
from Query
to QueryState
#9686
Moved get_component(_unchecked_mut)
from Query
to QueryState
#9686
Conversation
Also had to move `QueryComponentError` to match the new location of its methods. Also performed a QA pass to narrow the scope of `unsafe` blocks within `Query` methods.
Does it makes sense to move |
It might do, I started with
Additionally, neither
If we also migrate the above to |
|
I missed that merge from my branch, apologies! Below would be the complete list of candidates to migrate over:
I'm going to update my PR with the requested changes from @tguichaoua, then I'll migrate the above over just to demonstrate what that change would look like. |
Added to `QueryState`: * `component` * `component_unchecked_mut` * `many_read_only_manual` * `many_unchecked_manual`
Yes; I much prefer that! Unless there's a very good (and commented) reason not to, these APIs should be mirrors of each other. Due to the fact that every |
Co-authored-by: Tristan Guichaoua <[email protected]>
…evyengine#9686) # Objective - Fixes bevyengine#9683 ## Solution - Moved `get_component` from `Query` to `QueryState`. - Moved `get_component_unchecked_mut` from `Query` to `QueryState`. - Moved `QueryComponentError` from `bevy_ecs::system` to `bevy_ecs::query`. Minor Breaking Change. - Narrowed scope of `unsafe` blocks in `Query` methods. --- ## Migration Guide - `use bevy_ecs::system::QueryComponentError;` -> `use bevy_ecs::query::QueryComponentError;` ## Notes I am not very familiar with unsafe Rust nor its use within Bevy, so I may have committed a Rust faux pas during the migration. --------- Co-authored-by: Zac Harrold <[email protected]> Co-authored-by: Tristan Guichaoua <[email protected]>
Objective
QueryState::(get_)component(_mut)
#9683Solution
get_component
fromQuery
toQueryState
.get_component_unchecked_mut
fromQuery
toQueryState
.QueryComponentError
frombevy_ecs::system
tobevy_ecs::query
. Minor Breaking Change.unsafe
blocks inQuery
methods.Migration Guide
use bevy_ecs::system::QueryComponentError;
->use bevy_ecs::query::QueryComponentError;
Notes
I am not very familiar with unsafe Rust nor its use within Bevy, so I may have committed a Rust faux pas during the migration.