Skip to content

Commit 2e4e372

Browse files
committed
update benches, examples, tests
1 parent c8650d9 commit 2e4e372

File tree

12 files changed

+44
-42
lines changed

12 files changed

+44
-42
lines changed

benches/benches/bevy_ecs/scheduling/schedule.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ pub fn empty_schedule_run(criterion: &mut Criterion) {
127127
let mut schedule = Schedule::default();
128128
schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::SingleThreaded);
129129
group.bench_function("SingleThreaded", |bencher| {
130-
bencher.iter(|| schedule.run(&mut app.world));
130+
bencher.iter(|| schedule.run(app.world_mut()));
131131
});
132132

133133
let mut schedule = Schedule::default();
134134
schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::MultiThreaded);
135135
group.bench_function("MultiThreaded", |bencher| {
136-
bencher.iter(|| schedule.run(&mut app.world));
136+
bencher.iter(|| schedule.run(app.world_mut()));
137137
});
138138

139139
let mut schedule = Schedule::default();
140140
schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::Simple);
141141
group.bench_function("Simple", |bencher| {
142-
bencher.iter(|| schedule.run(&mut app.world));
142+
bencher.iter(|| schedule.run(app.world_mut()));
143143
});
144144
group.finish();
145145
}

examples/2d/mesh2d_manual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ pub const COLORED_MESH2D_SHADER_HANDLE: Handle<Shader> =
285285
impl Plugin for ColoredMesh2dPlugin {
286286
fn build(&self, app: &mut App) {
287287
// Load our custom shader
288-
let mut shaders = app.world.resource_mut::<Assets<Shader>>();
288+
let mut shaders = app.world_mut().resource_mut::<Assets<Shader>>();
289289
shaders.insert(
290290
&COLORED_MESH2D_SHADER_HANDLE,
291291
Shader::from_wgsl(COLORED_MESH2D_SHADER, file!()),

examples/app/custom_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn my_runner(mut app: App) {
1111
println!("Type stuff into the console");
1212
for line in io::stdin().lines() {
1313
{
14-
let mut input = app.world.resource_mut::<Input>();
14+
let mut input = app.world_mut().resource_mut::<Input>();
1515
input.0 = line.unwrap();
1616
}
1717
app.update();

examples/ecs/custom_schedule.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ fn main() {
3333
//
3434
// Note that we modify `MainScheduleOrder` directly in `main` and not in a startup system. The reason for this is
3535
// that the `MainScheduleOrder` cannot be modified from systems that are run as part of the `Main` schedule.
36-
let mut main_schedule_order = app.world.resource_mut::<MainScheduleOrder>();
36+
let mut main_schedule_order = app.world_mut().resource_mut::<MainScheduleOrder>();
3737
main_schedule_order.insert_after(Update, SingleThreadedUpdate);
3838

3939
// Adding a custom startup schedule works similarly, but needs to use `insert_startup_after`
4040
// instead of `insert_after`.
4141
app.add_schedule(Schedule::new(CustomStartup));
4242

43-
let mut main_schedule_order = app.world.resource_mut::<MainScheduleOrder>();
43+
let mut main_schedule_order = app.world_mut().resource_mut::<MainScheduleOrder>();
4444
main_schedule_order.insert_startup_after(PreStartup, CustomStartup);
4545

4646
app.add_systems(SingleThreadedUpdate, single_threaded_update_system)

examples/ecs/system_stepping.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn main() {
5454
* Stepping::continue_frame() is called
5555
* System has been configured to always run"#
5656
);
57-
let mut stepping = app.world.resource_mut::<Stepping>();
57+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
5858
stepping.add_schedule(Update).enable();
5959
app.update();
6060

@@ -65,7 +65,7 @@ fn main() {
6565
Stepping, step means run the next system across all the schedules
6666
that have been added to the Stepping resource."#
6767
);
68-
let mut stepping = app.world.resource_mut::<Stepping>();
68+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
6969
stepping.step_frame();
7070
app.update();
7171

@@ -89,7 +89,7 @@ fn main() {
8989
case, we previously performed a step, running one system in Update.
9090
This continue will cause all remaining systems in Update to run."#
9191
);
92-
let mut stepping = app.world.resource_mut::<Stepping>();
92+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
9393
stepping.continue_frame();
9494
app.update();
9595

@@ -102,7 +102,7 @@ fn main() {
102102
systems."#
103103
);
104104
for _ in 0..4 {
105-
let mut stepping = app.world.resource_mut::<Stepping>();
105+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
106106
stepping.step_frame();
107107
app.update();
108108
}
@@ -116,10 +116,10 @@ fn main() {
116116
execute all systems in the frame. Stepping::always_run() allows
117117
us to granularly allow systems to run when stepping is enabled."#
118118
);
119-
let mut stepping = app.world.resource_mut::<Stepping>();
119+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
120120
stepping.always_run(Update, update_system_two);
121121
for _ in 0..3 {
122-
let mut stepping = app.world.resource_mut::<Stepping>();
122+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
123123
stepping.step_frame();
124124
app.update();
125125
}
@@ -132,7 +132,7 @@ fn main() {
132132
Stepping::never_run() allows us to disable systems while Stepping
133133
is enabled."#
134134
);
135-
let mut stepping = app.world.resource_mut::<Stepping>();
135+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
136136
stepping.never_run(Update, update_system_two);
137137
stepping.continue_frame();
138138
app.update();
@@ -155,14 +155,14 @@ fn main() {
155155
During the final continue pre_update_system() and
156156
update_system_three() run."#
157157
);
158-
let mut stepping = app.world.resource_mut::<Stepping>();
158+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
159159
stepping.set_breakpoint(Update, update_system_two);
160160
stepping.continue_frame();
161161
app.update();
162-
let mut stepping = app.world.resource_mut::<Stepping>();
162+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
163163
stepping.step_frame();
164164
app.update();
165-
let mut stepping = app.world.resource_mut::<Stepping>();
165+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
166166
stepping.continue_frame();
167167
app.update();
168168

@@ -172,7 +172,7 @@ fn main() {
172172
through all systems
173173
Result: All systems will run"#
174174
);
175-
let mut stepping = app.world.resource_mut::<Stepping>();
175+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
176176
stepping.clear_breakpoint(Update, update_system_two);
177177
stepping.continue_frame();
178178
app.update();
@@ -184,7 +184,7 @@ fn main() {
184184
call Stepping::step_frame() or Stepping::continue_frame() to run
185185
systems in the Update schedule."#
186186
);
187-
let mut stepping = app.world.resource_mut::<Stepping>();
187+
let mut stepping = app.world_mut().resource_mut::<Stepping>();
188188
stepping.disable();
189189
app.update();
190190
}

examples/games/stepping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl Plugin for SteppingPlugin {
3636
// We need an independent schedule so we have access to all other
3737
// schedules through the `Stepping` resource
3838
app.init_schedule(DebugSchedule);
39-
let mut order = app.world.resource_mut::<MainScheduleOrder>();
39+
let mut order = app.world_mut().resource_mut::<MainScheduleOrder>();
4040
order.insert_after(Update, DebugSchedule);
4141

4242
// create our stepping resource

examples/shader/compute_shader_game_of_life.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Plugin for GameOfLifeComputePlugin {
8484
prepare_bind_group.in_set(RenderSet::PrepareBindGroups),
8585
);
8686

87-
let mut render_graph = render_app.world.resource_mut::<RenderGraph>();
87+
let mut render_graph = render_app.world_mut().resource_mut::<RenderGraph>();
8888
render_graph.add_node(GameOfLifeLabel, GameOfLifeNode::default());
8989
render_graph.add_node_edge(GameOfLifeLabel, bevy::render::graph::CameraDriverLabel);
9090
}

examples/shader/post_processing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Plugin for PostProcessPlugin {
5959
));
6060

6161
// We need to get the render app from the main app
62-
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else {
62+
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
6363
return;
6464
};
6565

@@ -97,7 +97,7 @@ impl Plugin for PostProcessPlugin {
9797

9898
fn finish(&self, app: &mut App) {
9999
// We need to get the render app from the main app
100-
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else {
100+
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
101101
return;
102102
};
103103

examples/shader/texture_binding_array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ impl Plugin for GpuFeatureSupportChecker {
3333
fn build(&self, _app: &mut App) {}
3434

3535
fn finish(&self, app: &mut App) {
36-
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else {
36+
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
3737
return;
3838
};
3939

40-
let render_device = render_app.world.resource::<RenderDevice>();
40+
let render_device = render_app.world().resource::<RenderDevice>();
4141

4242
// Check if the device support the required feature. If not, exit the example.
4343
// In a real application, you should setup a fallback for the missing feature

examples/stress_tests/many_lights.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ struct LogVisibleLights;
157157

158158
impl Plugin for LogVisibleLights {
159159
fn build(&self, app: &mut App) {
160-
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else {
160+
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
161161
return;
162162
};
163163

0 commit comments

Comments
 (0)