bevy/crates/bevy_ecs/src/world
Boxy 5c680a38a7 Move all logic to UnsafeWorldCell (#7381)
# Objective

- Implementing logic used by system params and `UnsafeWorldCell` on `&World` is sus since `&World` generally denotes shared read only access to world but this is a lie in the above situations. Move most/all logic that uses `&World` to mean `UnsafeWorldCell` onto `UnsafeWorldCell`
-  Add a way to take a `&mut World` out of `UnsafeWorldCell` and use this in `WorldCell`'s `Drop` impl instead of a `UnsafeCell` field

---

## Changelog

- changed some `UnsafeWorldCell` methods to take `self` instead of `&self`/`&mut self` since there is literally no point to them doing that
- `UnsafeWorldCell::world` is now used to get immutable access to the whole world instead of just the metadata which can now be done via `UnsafeWorldCell::world_metadata`
- `UnsafeWorldCell::world_mut` now exists and can be used to get a `&mut World` out of `UnsafeWorldCell`
- removed `UnsafeWorldCell::storages` since that is probably unsound since storages contains the actual component/resource data not just metadata

## Migration guide

N/A none of the breaking changes here make any difference for a 0.9->0.10 transition since `UnsafeWorldCell` did not exist in 0.9
2023-02-06 19:02:52 +00:00
..
entity_ref.rs Move all logic to UnsafeWorldCell (#7381) 2023-02-06 19:02:52 +00:00
identifier.rs Implement SparseSetIndex for WorldId (#7125) 2023-01-09 21:43:27 +00:00
mod.rs Move all logic to UnsafeWorldCell (#7381) 2023-02-06 19:02:52 +00:00
spawn_batch.rs add more SAFETY comments and lint for missing ones in bevy_ecs (#4835) 2022-07-04 14:44:24 +00:00
unsafe_world_cell.rs Move all logic to UnsafeWorldCell (#7381) 2023-02-06 19:02:52 +00:00
world_cell.rs Move all logic to UnsafeWorldCell (#7381) 2023-02-06 19:02:52 +00:00