bevy/crates/bevy_ecs/src/world
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
..
command_queue.rs Refactor command application for more consistency (#13249) 2024-05-28 12:17:57 +00:00
deferred_world.rs Refactor command application for more consistency (#13249) 2024-05-28 12:17:57 +00:00
entity_ref.rs Generalize component reflection to operate on FilteredEntityRef and FilteredEntityMut, not EntityRef and EntityMut. (#13549) 2024-05-28 14:02:09 +00:00
error.rs Replace all labels with interned labels (#7762) 2023-10-25 21:39:23 +00:00
identifier.rs impl ExclusiveSystemParam for WorldId (#11164) 2024-01-01 15:59:53 +00:00
mod.rs constrain WorldQuery::init_state argument to ComponentInitializer (#13442) 2024-05-30 14:47:22 +00:00
spawn_batch.rs Component Lifecycle Hooks and a Deferred World (#10756) 2024-03-01 14:59:22 +00:00
unsafe_world_cell.rs Refactor command application for more consistency (#13249) 2024-05-28 12:17:57 +00:00