bevy/examples/app
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
..
custom_loop.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
drag_and_drop.rs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
empty_defaults.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
empty.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
headless.rs Fix intra-doc link warnings (#10445) 2023-11-08 14:33:46 +00:00
log_layers_ecs.rs Fix failures of typos and check-cfg (#12293) 2024-03-04 07:48:09 +00:00
log_layers.rs Add access to App within LogPlugin::update_subscriber (#12045) 2024-03-04 00:01:05 +00:00
logs.rs fix some typos (#12038) 2024-02-22 18:55:22 +00:00
no_renderer.rs Add configuration for async pipeline creation on RenderPlugin (#11847) 2024-02-16 13:35:47 +00:00
plugin_group.rs Inverse missing_docs logic (#11676) 2024-02-03 21:40:55 +00:00
plugin.rs Inverse missing_docs logic (#11676) 2024-02-03 21:40:55 +00:00
return_after_run.rs fix some typos (#12038) 2024-02-22 18:55:22 +00:00
thread_pool_resources.rs Break CorePlugin into TaskPoolPlugin, TypeRegistrationPlugin, FrameCountPlugin. (#7083) 2023-01-05 11:42:35 +00:00
without_winit.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00