bevy/crates/bevy_ecs/src
Vic 5cfb063d4a
constrain WorldQuery::init_state argument to ComponentInitializer (#13442)
# Objective

In #13343, `WorldQuery::get_state` was constrained from `&World` as the
argument to `&Components`, but `WorldQuery::init_state` hasn't yet been
changed from `&mut World` to match.

Fixes #13358

## Solution

Create a wrapper around `&mut Components` and `&mut Storages` that can
be obtained from `&mut World` with a `component_initializer` method.
This new `ComponentInitializer` re-exposes the API on `&mut Components`
minus the `&mut Storages` parameter where it was present. For the
`&Components` API, it simply derefs to its `components` field.

## Changelog

### Added
The `World::component_initializer` method.
The `ComponentInitializer` struct that re-exposes `Components` API.
### Changed
`WorldQuery::init_state` now takes `&mut ComponentInitializer` instead
of `&mut World`.

## Migration Guide
Instead of passing `&mut World` to `WorldQuery::init_state` directly,
pass in a mutable reference to the struct returned from
`World::component_initializer`.
2024-05-30 14:47:22 +00:00
..
entity Revert "Add on_unimplemented Diagnostics to Most Public Traits" (#13413) 2024-05-17 17:00:43 +00:00
identifier Fix beta lints (#12980) 2024-04-16 02:46:46 +00:00
query constrain WorldQuery::init_state argument to ComponentInitializer (#13442) 2024-05-30 14:47:22 +00:00
reflect Generalize component reflection to operate on FilteredEntityRef and FilteredEntityMut, not EntityRef and EntityMut. (#13549) 2024-05-28 14:02:09 +00:00
schedule Revert "Add on_unimplemented Diagnostics to Most Public Traits" (#13413) 2024-05-17 17:00:43 +00:00
storage Fix uses of "it's" vs "its". (#13033) 2024-04-19 18:17:31 +00:00
system Refactor command application for more consistency (#13249) 2024-05-28 12:17:57 +00:00
world constrain WorldQuery::init_state argument to ComponentInitializer (#13442) 2024-05-30 14:47:22 +00:00
archetype.rs Adding some docs for archetype internals (#12578) 2024-03-23 01:48:31 +00:00
batching.rs Parallel event reader (#12554) 2024-04-22 16:37:42 +00:00
bundle.rs Refactor command application for more consistency (#13249) 2024-05-28 12:17:57 +00:00
change_detection.rs Implement WorldQuery and QueryData on Mut. (#13338) 2024-05-14 12:38:31 +00:00
component.rs constrain WorldQuery::init_state argument to ComponentInitializer (#13442) 2024-05-30 14:47:22 +00:00
event.rs Revert "Add on_unimplemented Diagnostics to Most Public Traits" (#13413) 2024-05-17 17:00:43 +00:00
intern.rs Moves intern and label modules into bevy_ecs (#12772) 2024-04-08 15:34:11 +00:00
label.rs Use ptr::from_ref and ptr::addr_eq in macro (#13081) 2024-04-24 01:54:24 +00:00
lib.rs Implement a SystemBuilder for building SystemParams (#13123) 2024-05-22 00:58:37 +00:00
removal_detection.rs Add RemovedComponentEvents::iter (#12815) 2024-04-01 20:20:30 +00:00