Commit 01649f1
authored
# 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>.`
1 parent ec7755d commit 01649f1
File tree
86 files changed
+1364
-943
lines changed- benches/benches/bevy_ecs/scheduling
- crates
- bevy_app/src
- bevy_asset/src
- io/embedded
- bevy_core_pipeline/src
- blit
- bloom
- contrast_adaptive_sharpening
- core_2d
- core_3d
- deferred
- fxaa
- skybox
- taa
- tonemapping
- upscaling
- bevy_core/src
- bevy_dev_tools/src
- bevy_diagnostic/src
- bevy_gizmos/src
- bevy_gltf/src
- bevy_log/src
- bevy_pbr/src
- deferred
- light_probe
- lightmap
- meshlet
- prepass
- render
- ssao
- bevy_render/src
- camera
- diagnostic
- mesh
- render_graph
- render_phase
- texture
- view
- visibility
- window
- bevy_scene/src
- bevy_sprite/src
- mesh2d
- bevy_text/src
- bevy_transform/src
- bevy_ui/src
- render
- bevy_window/src
- bevy_winit/src
- examples
- 2d
- app
- ecs
- games
- shader
- stress_tests
- time
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
86 files changed
+1364
-943
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
0 commit comments