bevy/crates
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
..
bevy_a11y Set the logo and favicon for all of Bevy's published crates (#12696) 2024-03-25 18:52:50 +00:00
bevy_animation Move FloatOrd into bevy_math (#12732) 2024-03-27 18:30:11 +00:00
bevy_app Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_asset Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_audio updated audio_source.rs documentation (#12765) 2024-03-28 19:10:09 +00:00
bevy_color Move Point out of cubic splines module and expand it (#12747) 2024-03-28 13:40:26 +00:00
bevy_core Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_core_pipeline Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_derive Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_dev_tools Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_diagnostic Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_dylib Set the logo and favicon for all of Bevy's published crates (#12696) 2024-03-25 18:52:50 +00:00
bevy_dynamic_plugin Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_ecs Store only the IDs needed for Query iteration (#12476) 2024-03-30 10:15:55 +00:00
bevy_ecs_compile_fail_tests Fix Ci failing over dead code in tests (#12623) 2024-03-21 18:08:47 +00:00
bevy_encase_derive Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_gilrs Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_gizmos Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_gltf Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_hierarchy Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_input Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_internal Fix ambiguities causing a crash (#12780) 2024-03-29 16:00:13 +00:00
bevy_log Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_macro_utils Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_macros_compile_fail_tests Fix Ci failing over dead code in tests (#12623) 2024-03-21 18:08:47 +00:00
bevy_math Remove VectorSpace impl on Quat (#12796) 2024-03-30 17:18:52 +00:00
bevy_mikktspace Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_pbr Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_ptr Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_reflect Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_reflect_compile_fail_tests Fix Ci failing over dead code in tests (#12623) 2024-03-21 18:08:47 +00:00
bevy_render Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_scene Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_sprite Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_tasks Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_text Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_time Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_transform Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_ui Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_utils Move FloatOrd into bevy_math (#12732) 2024-03-27 18:30:11 +00:00
bevy_window Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_winit Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00