pub struct SubApp {
pub update_schedule: Option<Interned<dyn ScheduleLabel>>,
/* private fields */
}Expand description
A secondary application with its own World. These can run independently of each other.
These are useful for situations where certain processes (e.g. a render thread) need to be kept separate from the main application.
§Example
#[derive(Resource, Default)]
struct Val(pub i32);
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, AppLabel, Default)]
struct ExampleApp;
// Create an app with a certain resource.
let mut app = App::new();
app.insert_resource(Val(10));
// Create a sub-app with the same resource and a single schedule.
let mut sub_app = SubApp::new();
sub_app.update_schedule = Some(Main.intern());
sub_app.insert_resource(Val(100));
// Setup an extract function to copy the resource's value in the main world.
sub_app.set_extract(|main_world, sub_world| {
sub_world.resource_mut::<Val>().0 = main_world.resource::<Val>().0;
});
// Schedule a system that will verify extraction is working.
sub_app.add_systems(Main, |counter: Res<Val>| {
// The value will be copied during extraction, so we should see 10 instead of 100.
assert_eq!(counter.0, 10);
});
// Add the sub-app to the main app.
app.insert_sub_app(ExampleApp, sub_app);
// Update the application once (using the default runner).
app.run();Fields§
§update_schedule: Option<Interned<dyn ScheduleLabel>>The schedule that will be run by update.
Implementations§
Source§impl SubApp
impl SubApp
Sourcepub fn world(&self) -> &World
pub fn world(&self) -> &World
Returns a reference to the World.
Examples found in repository?
96 fn update(&mut self) {
97 self.0.update();
98 // Wait for frame to finish rendering by wait polling the device
99 self.0
100 .main
101 .world()
102 .resource::<RenderDevice>()
103 .wgpu_device()
104 .poll(PollType::Wait {
105 submission_index: None,
106 timeout: None,
107 })
108 .unwrap();
109 }More examples
91fn count_ambiguities(sub_app: &mut SubApp) -> AmbiguitiesCount {
92 let schedule_labels = sub_app
93 .world()
94 .resource::<Schedules>()
95 .iter()
96 .map(|(_, schedule)| schedule.label())
97 .collect::<Vec<_>>();
98 let mut ambiguities = <HashMap<_, _>>::default();
99 for label in schedule_labels {
100 let ambiguities_in_schedule =
101 sub_app
102 .world_mut()
103 .schedule_scope(label, |world, schedule| {
104 schedule.initialize(world).unwrap().unwrap();
105 schedule.graph().conflicting_systems().len()
106 });
107 ambiguities.insert(label, ambiguities_in_schedule);
108 }
109 AmbiguitiesCount(ambiguities)
110}Sourcepub fn world_mut(&mut self) -> &mut World
pub fn world_mut(&mut self) -> &mut World
Returns a mutable reference to the World.
Examples found in repository?
75 fn new_render_target(&mut self, width: u32, height: u32) -> RenderTarget {
76 let mut target =
77 Image::new_target_texture(width, height, TextureFormat::Rgba8UnormSrgb, None);
78 target.asset_usage = RenderAssetUsages::RENDER_WORLD;
79 self.0
80 .main
81 .world_mut()
82 .resource_mut::<Assets<Image>>()
83 .add(target)
84 .into()
85 }
86
87 fn spawn_camera(&mut self, target: RenderTarget) -> Entity {
88 self.0
89 .main
90 .world_mut()
91 .spawn((Camera3d::default(), target, Transform::IDENTITY))
92 .id()
93 }
94
95 // Run one world update and wait for rendering to finish.
96 fn update(&mut self) {
97 self.0.update();
98 // Wait for frame to finish rendering by wait polling the device
99 self.0
100 .main
101 .world()
102 .resource::<RenderDevice>()
103 .wgpu_device()
104 .poll(PollType::Wait {
105 submission_index: None,
106 timeout: None,
107 })
108 .unwrap();
109 }
110
111 // Schedules a screenshot to be captured on the next update.
112 fn screenshot(&mut self, target: RenderTarget, i: u32) {
113 self.0
114 .main
115 .world_mut()
116 .spawn(Screenshot::image(target.as_image().unwrap().clone()))
117 .observe(save_to_disk(format!("test_images/screenshot{i}.png")));
118 }More examples
62 fn finish(&self, app: &mut App) {
63 let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
64 return;
65 };
66 render_app
67 .world_mut()
68 .resource_mut::<MeshAllocatorSettings>()
69 // This allows using the mesh allocator slabs as
70 // storage buffers directly in the compute shader.
71 // Which means that we can write from our compute
72 // shader directly to the allocated mesh slabs.
73 .extra_buffer_usages = BufferUsages::STORAGE;
74 }70fn configure_ambiguity_detection(sub_app: &mut SubApp) {
71 let mut schedules = sub_app.world_mut().resource_mut::<Schedules>();
72 for (_, schedule) in schedules.iter_mut() {
73 schedule.set_build_settings(ScheduleBuildSettings {
74 // NOTE: you can change this to `LogLevel::Ignore` to easily see the current number of ambiguities.
75 ambiguity_detection: LogLevel::Warn,
76 // With auto-inserted apply_deferred stages, these can cause two ambiguous systems to
77 // become accidentally ordered by one of the apply_deferred stages. Disabling requires
78 // us to meet a higher bar. We don't just want no ambiguities - we also don't want
79 // changes to systems or the auto-insert code from "creating" new ambiguities (by
80 // reordering the graph). However, the cost is that the graph is no longer runnable,
81 // since Bevy crates often rely on auto-insert apply_deferred to not panic (e.g.,
82 // because a resource wasn't inserted).
83 auto_insert_apply_deferred: false,
84 use_shortnames: false,
85 ..default()
86 });
87 }
88}
89
90/// Returns the number of conflicting systems per schedule.
91fn count_ambiguities(sub_app: &mut SubApp) -> AmbiguitiesCount {
92 let schedule_labels = sub_app
93 .world()
94 .resource::<Schedules>()
95 .iter()
96 .map(|(_, schedule)| schedule.label())
97 .collect::<Vec<_>>();
98 let mut ambiguities = <HashMap<_, _>>::default();
99 for label in schedule_labels {
100 let ambiguities_in_schedule =
101 sub_app
102 .world_mut()
103 .schedule_scope(label, |world, schedule| {
104 schedule.initialize(world).unwrap().unwrap();
105 schedule.graph().conflicting_systems().len()
106 });
107 ambiguities.insert(label, ambiguities_in_schedule);
108 }
109 AmbiguitiesCount(ambiguities)
110}Sourcepub fn run_default_schedule(&mut self)
pub fn run_default_schedule(&mut self)
Runs the default schedule.
Does not clear internal trackers used for change detection.
Sourcepub fn extract(&mut self, world: &mut World)
pub fn extract(&mut self, world: &mut World)
Extracts data from world into the app’s world using the registered extract method.
Note: There is no default extract method. Calling extract does nothing if
set_extract has not been called.
Sourcepub fn set_extract<F>(&mut self, extract: F) -> &mut SubApp
pub fn set_extract<F>(&mut self, extract: F) -> &mut SubApp
Sets the method that will be called by extract.
The first argument is the World to extract data from, the second argument is the app World.
Sourcepub fn take_extract(
&mut self,
) -> Option<Box<dyn FnMut(&mut World, &mut World) + Send>>
pub fn take_extract( &mut self, ) -> Option<Box<dyn FnMut(&mut World, &mut World) + Send>>
Take the function that will be called by extract out of the app, if any was set,
and replace it with None.
If you use Bevy, bevy_render will set a default extract function used to extract data from
the main world into the render world as part of the Extract phase. In that case, you cannot replace
it with your own function. Instead, take the Bevy default function with this, and install your own
instead which calls the Bevy default.
let mut default_fn = app.take_extract();
app.set_extract(move |main, render| {
// Do pre-extract custom logic
// [...]
// Call Bevy's default, which executes the Extract phase
if let Some(f) = default_fn.as_mut() {
f(main, render);
}
// Do post-extract custom logic
// [...]
});Sourcepub fn insert_resource<R>(&mut self, resource: R) -> &mut SubAppwhere
R: Resource,
pub fn insert_resource<R>(&mut self, resource: R) -> &mut SubAppwhere
R: Resource,
See App::insert_resource.
Examples found in repository?
47fn main() {
48 let mut app = App::new();
49
50 // Main World
51 app.insert_resource(WorldName("Main World".into()))
52 .add_plugins((
53 DefaultPlugins,
54 // Plugin for automatically extracting A.
55 ExtractComponentPlugin::<A>::default(),
56 ))
57 .add_message::<ExtractMessage>()
58 .add_systems(Startup, setup)
59 .add_systems(Update, (set_time, trigger_extraction, display_state));
60
61 let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
62 return;
63 };
64
65 // Render World
66 render_app
67 .insert_resource(WorldName("Render World".into()))
68 .add_systems(ExtractSchedule, extract_components)
69 .add_systems(Render, display_state);
70
71 app.run();
72}More examples
205 fn build(&self, app: &mut App) {
206 let (s, r) = crossbeam_channel::unbounded();
207
208 let render_app = app
209 .insert_resource(MainWorldReceiver(r))
210 .sub_app_mut(RenderApp);
211
212 render_app
213 .insert_resource(RenderWorldSender(s))
214 // Make ImageCopiers accessible in RenderWorld system and plugin
215 .add_systems(ExtractSchedule, image_copy_extract)
216 // Receives image data from buffer to channel
217 // so we need to run it after the render graph is done
218 .add_systems(
219 Render,
220 receive_image_from_buffer.after(RenderSystems::Render),
221 )
222 .add_systems(
223 RenderGraph,
224 image_copy_driver.after(RenderGraphSystems::Submit),
225 );
226 }210 fn build(&self, app: &mut App) {
211 // Create the `SavedIndirectParameters` resource that we're going to use
212 // to communicate between the thread that the GPU-to-CPU readback
213 // callback runs on and the main application threads. This resource is
214 // atomically reference counted. We store one reference to the
215 // `SavedIndirectParameters` in the main app and another reference in
216 // the render app.
217 let saved_indirect_parameters = SavedIndirectParameters::new();
218 app.insert_resource(saved_indirect_parameters.clone());
219
220 // Fetch the render app.
221 let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
222 return;
223 };
224
225 render_app
226 // Insert another reference to the `SavedIndirectParameters`.
227 .insert_resource(saved_indirect_parameters)
228 // Setup the parameters in RenderStartup.
229 .add_systems(RenderStartup, init_saved_indirect_parameters)
230 .init_resource::<IndirectParametersStagingBuffers>()
231 .add_systems(ExtractSchedule, readback_indirect_parameters)
232 .add_systems(
233 Render,
234 create_indirect_parameters_staging_buffers
235 .in_set(RenderSystems::PrepareResourcesFlush),
236 )
237 .add_systems(
238 Core3d,
239 // Add the node that allows us to read the indirect parameters back
240 // from the GPU to the CPU, which allows us to determine how many
241 // meshes were culled.
242 readback_indirect_parameters_node
243 // We read back the indirect parameters any time after
244 // `MainPass`. Readback doesn't particularly need to execute
245 // before PostProcess, but we order it that way anyway.
246 .after(Core3dSystems::MainPass)
247 .before(Core3dSystems::PostProcess),
248 );
249 }318 fn build(&self, app: &mut App) {
319 // Load our custom shader
320 let mut shaders = app.world_mut().resource_mut::<Assets<Shader>>();
321 // Here, we construct and add the shader asset manually. There are many ways to load this
322 // shader, including `embedded_asset`/`load_embedded_asset`.
323 let shader = shaders.add(Shader::from_wesl(COLORED_MESH2D_SHADER, file!()));
324
325 app.add_plugins(SyncComponentPlugin::<ColoredMesh2d>::default());
326
327 // Register our custom draw function, and add our render systems
328 app.get_sub_app_mut(RenderApp)
329 .unwrap()
330 .init_resource::<DrawFunctions<TransparentColoredMesh2d>>()
331 // Declare a render phase, `TransparentColoredMesh2d`, to go with
332 // our pipeline.
333 .init_resource::<ViewSortedRenderPhases<TransparentColoredMesh2d>>()
334 // Declare the pipeline itself.
335 .init_resource::<SpecializedRenderPipelines<ColoredMesh2dPipeline>>()
336 // Declare the render-world resource that will hold the instances.
337 .init_resource::<RenderColoredMesh2dInstances>()
338 .insert_resource(ColoredMesh2dShader(shader))
339 // Declare a new render command.
340 .add_render_command::<TransparentColoredMesh2d, DrawTransparentColoredMesh2d>()
341 .add_systems(
342 RenderStartup,
343 init_colored_mesh_2d_pipeline.after(init_mesh_2d_pipeline),
344 )
345 .add_systems(
346 ExtractSchedule,
347 (
348 extract_colored_mesh2d.after(extract_2d_meshes),
349 extract_colored_mesh2d_camera_phases,
350 ),
351 )
352 .add_systems(
353 Render,
354 (
355 sort_phase_system::<TransparentColoredMesh2d>.in_set(RenderSystems::PhaseSort),
356 queue_colored_mesh2d.in_set(RenderSystems::QueueMeshes),
357 // Make sure to prepare the render phase.
358 batch_and_prepare_sorted_render_phase::<
359 TransparentColoredMesh2d,
360 ColoredMesh2dPipeline,
361 >
362 .in_set(RenderSystems::PrepareResources),
363 ),
364 )
365 .add_systems(
366 Core2d,
367 // Add the draw command to draw the items in our custom phase.
368 main_colored_transparent_pass_2d.in_set(Core2dSystems::MainPass),
369 );
370 }Sourcepub fn init_resource<R>(&mut self) -> &mut SubApp
pub fn init_resource<R>(&mut self) -> &mut SubApp
See App::init_resource.
Examples found in repository?
More examples
110 fn build(&self, app: &mut App) {
111 app.add_plugins(ExtractComponentPlugin::<InstanceMaterialData>::default());
112 app.sub_app_mut(RenderApp)
113 .add_render_command::<Transparent3d, DrawCustom>()
114 .init_resource::<SpecializedMeshPipelines<CustomPipeline>>()
115 .add_systems(
116 RenderStartup,
117 init_custom_pipeline.after(MeshPipelineSystems),
118 )
119 .add_systems(
120 Render,
121 (
122 queue_custom.in_set(RenderSystems::QueueMeshes),
123 prepare_instance_buffers.in_set(RenderSystems::PrepareResources),
124 ),
125 );
126 }166fn main() {
167 let mut app = App::new();
168 app.add_plugins(DefaultPlugins)
169 .add_plugins(ExtractComponentPlugin::<CustomRenderedEntity>::default())
170 .add_systems(Startup, setup);
171
172 // We make sure to add these to the render app, not the main app.
173 app.sub_app_mut(RenderApp)
174 .init_resource::<CustomPhasePipeline>()
175 .init_resource::<PendingCustomPhaseItemQueues>()
176 .add_render_command::<Opaque3d, DrawCustomPhaseItemCommands>()
177 .add_systems(
178 Render,
179 prepare_custom_phase_item_buffers.in_set(RenderSystems::Prepare),
180 )
181 .add_systems(Render, queue_custom_phase_item.in_set(RenderSystems::Queue));
182
183 app.run();
184}94 fn build(&self, app: &mut App) {
95 // Extract the game of life image resource from the main world into the render world
96 // for operation on by the compute shader and display on the sprite.
97 app.add_plugins((
98 ExtractResourcePlugin::<GameOfLifeImages>::default(),
99 ExtractResourcePlugin::<GameOfLifeUniforms>::default(),
100 ));
101 let render_app = app.sub_app_mut(RenderApp);
102 render_app
103 .init_resource::<GameOfLifeState>()
104 .add_systems(RenderStartup, init_game_of_life_pipeline)
105 .add_systems(
106 Render,
107 prepare_bind_group.in_set(RenderSystems::PrepareBindGroups),
108 )
109 .add_systems(Render, update.in_set(RenderSystems::Prepare))
110 .add_systems(RenderGraph, game_of_life.before(camera_driver));
111 }128 fn build(&self, app: &mut App) {
129 app.add_plugins(ExtractComponentPlugin::<CustomRenderedEntity>::default());
130
131 // We make sure to add these to the render app, not the main app.
132 let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
133 return;
134 };
135 render_app
136 // This is needed to tell bevy about your custom pipeline
137 .init_resource::<SpecializedMeshPipelines<CustomMeshPipeline>>()
138 .init_resource::<PendingCustomMeshQueues>()
139 // We need to use a custom draw command so we need to register it
140 .add_render_command::<Opaque3d, DrawSpecializedPipelineCommands>()
141 .add_systems(
142 RenderStartup,
143 init_custom_mesh_pipeline.after(MeshPipelineSystems),
144 )
145 .add_systems(
146 Render,
147 queue_custom_mesh_pipeline.in_set(RenderSystems::Queue),
148 );
149 }136 fn build(&self, app: &mut App) {
137 app.add_plugins((
138 ExtractComponentPlugin::<DrawStencil>::default(),
139 SortedRenderPhasePlugin::<Stencil3d, MeshPipeline>::new(RenderDebugFlags::default()),
140 ));
141 // We need to get the render app from the main app
142 let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
143 return;
144 };
145 render_app
146 .init_resource::<SpecializedMeshPipelines<StencilPipeline>>()
147 .init_resource::<DrawFunctions<Stencil3d>>()
148 .add_render_command::<Stencil3d, DrawMesh3dStencil>()
149 .init_resource::<ViewSortedRenderPhases<Stencil3d>>()
150 .init_resource::<PendingCustomMeshQueues>()
151 .add_systems(
152 RenderStartup,
153 init_stencil_pipeline.after(MeshPipelineSystems),
154 )
155 .add_systems(ExtractSchedule, extract_camera_phases)
156 .add_systems(
157 Render,
158 (
159 queue_custom_meshes.in_set(RenderSystems::QueueMeshes),
160 sort_phase_system::<Stencil3d>.in_set(RenderSystems::PhaseSort),
161 batch_and_prepare_sorted_render_phase::<Stencil3d, StencilPipeline>
162 .in_set(RenderSystems::PrepareResources),
163 ),
164 )
165 .add_systems(
166 Core3d,
167 custom_draw_system
168 .after(main_opaque_pass_3d)
169 .in_set(Core3dSystems::MainPass),
170 );
171 }Sourcepub fn add_systems<M>(
&mut self,
schedule: impl ScheduleLabel,
systems: impl IntoScheduleConfigs<Box<dyn System<Out = (), In = ()>>, M>,
) -> &mut SubApp
pub fn add_systems<M>( &mut self, schedule: impl ScheduleLabel, systems: impl IntoScheduleConfigs<Box<dyn System<Out = (), In = ()>>, M>, ) -> &mut SubApp
See App::add_systems.
Examples found in repository?
More examples
20fn main() {
21 let mut app = App::new();
22 app.add_plugins((
23 DefaultPlugins,
24 ExtractResourcePlugin::<RenderError>::default(),
25 ))
26 .add_systems(Startup, setup)
27 .add_systems(Update, (update_camera, input))
28 .init_resource::<RenderError>()
29 .sub_app_mut(RenderApp)
30 .add_systems(Render, cause_error);
31 app.run();
32}113 fn build(&self, app: &mut App) {
114 let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
115 return;
116 };
117
118 render_app
119 .add_systems(RenderStartup, init_mesh_pipelines)
120 .add_systems(
121 Core3d,
122 draw_mesh_shader_cubes
123 .after(main_opaque_pass_3d)
124 .in_set(Core3dSystems::MainPass),
125 );
126 }- examples/shader/gpu_readback.rs
- examples/shader_advanced/custom_shader_instancing.rs
- examples/shader_advanced/custom_phase_item.rs
- examples/ecs/extraction.rs
- examples/shader_advanced/render_depth_to_texture.rs
- examples/app/headless_renderer.rs
- examples/shader/compute_shader_game_of_life.rs
- examples/shader_advanced/specialized_mesh_pipeline.rs
- examples/shader_advanced/manual_material.rs
- examples/shader_advanced/deferred_raymarch.rs
- examples/shader_advanced/custom_post_processing.rs
- examples/shader_advanced/custom_render_phase.rs
- examples/2d/dynamic_mip_generation.rs
- examples/3d/occlusion_culling.rs
- examples/2d/mesh2d_manual.rs
Sourcepub fn remove_systems_in_set<M>(
&mut self,
schedule: impl ScheduleLabel,
set: impl IntoSystemSet<M>,
policy: ScheduleCleanupPolicy,
) -> Result<usize, ScheduleError>
pub fn remove_systems_in_set<M>( &mut self, schedule: impl ScheduleLabel, set: impl IntoSystemSet<M>, policy: ScheduleCleanupPolicy, ) -> Result<usize, ScheduleError>
Sourcepub fn register_system<I, O, M>(
&mut self,
system: impl IntoSystem<I, O, M> + 'static,
) -> SystemId<I, O>where
I: SystemInput + 'static,
O: 'static,
pub fn register_system<I, O, M>(
&mut self,
system: impl IntoSystem<I, O, M> + 'static,
) -> SystemId<I, O>where
I: SystemInput + 'static,
O: 'static,
See App::register_system.
Sourcepub fn register_tracked_system<I, O, M>(
&mut self,
system: impl IntoSystem<I, O, M> + 'static,
) -> SystemHandle<I, O>where
I: SystemInput + 'static,
O: 'static,
pub fn register_tracked_system<I, O, M>(
&mut self,
system: impl IntoSystem<I, O, M> + 'static,
) -> SystemHandle<I, O>where
I: SystemInput + 'static,
O: 'static,
Sourcepub fn configure_sets<M>(
&mut self,
schedule: impl ScheduleLabel,
sets: impl IntoScheduleConfigs<Interned<dyn SystemSet>, M>,
) -> &mut SubApp
pub fn configure_sets<M>( &mut self, schedule: impl ScheduleLabel, sets: impl IntoScheduleConfigs<Interned<dyn SystemSet>, M>, ) -> &mut SubApp
See App::configure_sets.
Sourcepub fn add_schedule(&mut self, schedule: Schedule) -> &mut SubApp
pub fn add_schedule(&mut self, schedule: Schedule) -> &mut SubApp
See App::add_schedule.
Sourcepub fn init_schedule(&mut self, label: impl ScheduleLabel) -> &mut SubApp
pub fn init_schedule(&mut self, label: impl ScheduleLabel) -> &mut SubApp
See App::init_schedule.
Sourcepub fn get_schedule(&self, label: impl ScheduleLabel) -> Option<&Schedule>
pub fn get_schedule(&self, label: impl ScheduleLabel) -> Option<&Schedule>
See App::get_schedule.
Sourcepub fn get_schedule_mut(
&mut self,
label: impl ScheduleLabel,
) -> Option<&mut Schedule>
pub fn get_schedule_mut( &mut self, label: impl ScheduleLabel, ) -> Option<&mut Schedule>
Sourcepub fn edit_schedule(
&mut self,
label: impl ScheduleLabel,
f: impl FnMut(&mut Schedule),
) -> &mut SubApp
pub fn edit_schedule( &mut self, label: impl ScheduleLabel, f: impl FnMut(&mut Schedule), ) -> &mut SubApp
See App::edit_schedule.
Sourcepub fn configure_schedules(
&mut self,
schedule_build_settings: ScheduleBuildSettings,
) -> &mut SubApp
pub fn configure_schedules( &mut self, schedule_build_settings: ScheduleBuildSettings, ) -> &mut SubApp
Sourcepub fn allow_ambiguous_component<T>(&mut self) -> &mut SubAppwhere
T: Component,
pub fn allow_ambiguous_component<T>(&mut self) -> &mut SubAppwhere
T: Component,
Sourcepub fn allow_ambiguous_resource<T>(&mut self) -> &mut SubAppwhere
T: Resource,
pub fn allow_ambiguous_resource<T>(&mut self) -> &mut SubAppwhere
T: Resource,
Sourcepub fn ignore_ambiguity<M1, M2, S1, S2>(
&mut self,
schedule: impl ScheduleLabel,
a: S1,
b: S2,
) -> &mut SubAppwhere
S1: IntoSystemSet<M1>,
S2: IntoSystemSet<M2>,
pub fn ignore_ambiguity<M1, M2, S1, S2>(
&mut self,
schedule: impl ScheduleLabel,
a: S1,
b: S2,
) -> &mut SubAppwhere
S1: IntoSystemSet<M1>,
S2: IntoSystemSet<M2>,
Sourcepub fn add_observer<M>(&mut self, observer: impl IntoObserver<M>) -> &mut SubApp
pub fn add_observer<M>(&mut self, observer: impl IntoObserver<M>) -> &mut SubApp
See App::add_observer.
Sourcepub fn add_message<T>(&mut self) -> &mut SubAppwhere
T: Message,
pub fn add_message<T>(&mut self) -> &mut SubAppwhere
T: Message,
See App::add_message.
Sourcepub fn add_plugins<M>(&mut self, plugins: impl Plugins<M>) -> &mut SubApp
pub fn add_plugins<M>(&mut self, plugins: impl Plugins<M>) -> &mut SubApp
See App::add_plugins.
Sourcepub fn is_plugin_added<T>(&self) -> boolwhere
T: Plugin,
pub fn is_plugin_added<T>(&self) -> boolwhere
T: Plugin,
See App::is_plugin_added.
Sourcepub fn get_added_plugins<T>(&self) -> Vec<&T>where
T: Plugin,
pub fn get_added_plugins<T>(&self) -> Vec<&T>where
T: Plugin,
Sourcepub fn plugins_state(&mut self) -> PluginsState
pub fn plugins_state(&mut self) -> PluginsState
Return the state of plugins.
Sourcepub fn finish(&mut self)
pub fn finish(&mut self)
Runs Plugin::finish for each plugin.
Sourcepub fn cleanup(&mut self)
pub fn cleanup(&mut self)
Runs Plugin::cleanup for each plugin.
Sourcepub fn register_type<T>(&mut self) -> &mut SubAppwhere
T: GetTypeRegistration,
Available on crate feature bevy_reflect only.
pub fn register_type<T>(&mut self) -> &mut SubAppwhere
T: GetTypeRegistration,
bevy_reflect only.See App::register_type.
Sourcepub fn register_type_data<T, D>(&mut self) -> &mut SubApp
Available on crate feature bevy_reflect only.
pub fn register_type_data<T, D>(&mut self) -> &mut SubApp
bevy_reflect only.Sourcepub fn register_type_conversion<T, U, F>(&mut self, function: F) -> &mut SubApp
Available on crate feature bevy_reflect only.
pub fn register_type_conversion<T, U, F>(&mut self, function: F) -> &mut SubApp
bevy_reflect only.Sourcepub fn register_into_type_conversion<T, U>(&mut self) -> &mut SubApp
Available on crate feature bevy_reflect only.
pub fn register_into_type_conversion<T, U>(&mut self) -> &mut SubApp
bevy_reflect only.Sourcepub fn register_function<F, Marker>(&mut self, function: F) -> &mut SubAppwhere
F: IntoFunction<'static, Marker> + 'static,
Available on crate feature reflect_functions only.
pub fn register_function<F, Marker>(&mut self, function: F) -> &mut SubAppwhere
F: IntoFunction<'static, Marker> + 'static,
reflect_functions only.Sourcepub fn register_function_with_name<F, Marker>(
&mut self,
name: impl Into<Cow<'static, str>>,
function: F,
) -> &mut SubAppwhere
F: IntoFunction<'static, Marker> + 'static,
Available on crate feature reflect_functions only.
pub fn register_function_with_name<F, Marker>(
&mut self,
name: impl Into<Cow<'static, str>>,
function: F,
) -> &mut SubAppwhere
F: IntoFunction<'static, Marker> + 'static,
reflect_functions only.Trait Implementations§
Source§impl AddRenderCommand for SubApp
impl AddRenderCommand for SubApp
Source§fn add_render_command<P, C>(&mut self) -> &mut SubAppwhere
P: PhaseItem,
C: RenderCommand<P> + Send + Sync + 'static,
<C as RenderCommand<P>>::Param: ReadOnlySystemParam,
fn add_render_command<P, C>(&mut self) -> &mut SubAppwhere
P: PhaseItem,
C: RenderCommand<P> + Send + Sync + 'static,
<C as RenderCommand<P>>::Param: ReadOnlySystemParam,
RenderCommand for the specified render phase to the app.Source§impl AppExtStates for SubApp
impl AppExtStates for SubApp
Source§fn init_state<S>(&mut self) -> &mut SubAppwhere
S: FreelyMutableState + FromWorld,
fn init_state<S>(&mut self) -> &mut SubAppwhere
S: FreelyMutableState + FromWorld,
Source§fn insert_state<S>(&mut self, state: S) -> &mut SubAppwhere
S: FreelyMutableState,
fn insert_state<S>(&mut self, state: S) -> &mut SubAppwhere
S: FreelyMutableState,
Source§fn add_computed_state<S>(&mut self) -> &mut SubAppwhere
S: ComputedStates,
fn add_computed_state<S>(&mut self) -> &mut SubAppwhere
S: ComputedStates,
ComputedStates. Read moreSource§fn add_sub_state<S>(&mut self) -> &mut SubAppwhere
S: SubStates,
fn add_sub_state<S>(&mut self) -> &mut SubAppwhere
S: SubStates,
Source§fn register_type_state<S>(&mut self) -> &mut SubApp
fn register_type_state<S>(&mut self) -> &mut SubApp
bevy_reflect only.T using App::register_type,
and adds ReflectState type data to T in the type registry. Read moreSource§fn register_type_mutable_state<S>(&mut self) -> &mut SubApp
fn register_type_mutable_state<S>(&mut self) -> &mut SubApp
bevy_reflect only.T using App::register_type,
and adds crate::reflect::ReflectState and crate::reflect::ReflectFreelyMutableState type data to T in the type registry. Read moreSource§impl GpuResourceAppExt for SubApp
impl GpuResourceAppExt for SubApp
Source§fn init_gpu_resource<R>(&mut self) -> &mut SubApp
fn init_gpu_resource<R>(&mut self) -> &mut SubApp
RenderStartup. Read moreSource§impl RegisterDiagnostic for SubApp
impl RegisterDiagnostic for SubApp
Source§fn register_diagnostic(&mut self, diagnostic: Diagnostic) -> &mut SubApp
fn register_diagnostic(&mut self, diagnostic: Diagnostic) -> &mut SubApp
Source§impl StateScopedMessagesAppExt for SubApp
impl StateScopedMessagesAppExt for SubApp
Auto Trait Implementations§
impl !Freeze for SubApp
impl !RefUnwindSafe for SubApp
impl !Sync for SubApp
impl !UnwindSafe for SubApp
impl Send for SubApp
impl Unpin for SubApp
impl UnsafeUnpin for SubApp
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.