bevy/crates/bevy_scene/src
Cameron 01649f13e2
Refactor App and SubApp internals for better separation (#9202)
# Objective

This is a necessary precursor to #9122 (this was split from that PR to
reduce the amount of code to review all at once).

Moving `!Send` resource ownership to `App` will make it unambiguously
`!Send`. `SubApp` must be `Send`, so it can't wrap `App`.

## Solution

Refactor `App` and `SubApp` to not have a recursive relationship. Since
`SubApp` no longer wraps `App`, once `!Send` resources are moved out of
`World` and into `App`, `SubApp` will become unambiguously `Send`.

There could be less code duplication between `App` and `SubApp`, but
that would break `App` method chaining.

## Changelog

- `SubApp` no longer wraps `App`.
- `App` fields are no longer publicly accessible.
- `App` can no longer be converted into a `SubApp`.
- Various methods now return references to a `SubApp` instead of an
`App`.
## Migration Guide

- To construct a sub-app, use `SubApp::new()`. `App` can no longer
convert into `SubApp`.
- If you implemented a trait for `App`, you may want to implement it for
`SubApp` as well.
- If you're accessing `app.world` directly, you now have to use
`app.world()` and `app.world_mut()`.
- `App::sub_app` now returns `&SubApp`.
- `App::sub_app_mut`  now returns `&mut SubApp`.
- `App::get_sub_app` now returns `Option<&SubApp>.`
- `App::get_sub_app_mut` now returns `Option<&mut SubApp>.`
2024-03-31 03:16:10 +00:00
..
bundle.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
dynamic_scene_builder.rs Make builder types take and return Self (#10001) 2023-10-09 19:46:17 +00:00
dynamic_scene.rs Fix TypeRegistry use in dynamic scene (#12715) 2024-03-28 03:09:31 +00:00
lib.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
scene_filter.rs Make builder types take and return Self (#10001) 2023-10-09 19:46:17 +00:00
scene_loader.rs Fix TypeRegistry use in dynamic scene (#12715) 2024-03-28 03:09:31 +00:00
scene_spawner.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
scene.rs Replace FromWorld requirement on ReflectResource and reflect Resource for State<S> (#12136) 2024-02-27 15:49:39 +00:00
serde.rs Fix TypeRegistry use in dynamic scene (#12715) 2024-03-28 03:09:31 +00:00