Skip to content

Commit 031bb09

Browse files
authored
Refactor event system documentation in system_param.rs (bevyengine#17364)
Just clarify the role of `ParamSet` in this code snippet
1 parent 47d25c1 commit 031bb09

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

crates/bevy_ecs/src/system/system_param.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,16 @@ unsafe impl<'w, 's, D: ReadOnlyQueryData + 'static, F: QueryFilter + 'static> Re
645645
/// # }
646646
/// fn event_system(
647647
/// mut set: ParamSet<(
648-
/// // `EventReader`s and `EventWriter`s conflict with each other,
649-
/// // since they both access the event queue resource for `MyEvent`.
648+
/// // PROBLEM: `EventReader` and `EventWriter` cannot be used together normally,
649+
/// // because they both need access to the same event queue.
650+
/// // SOLUTION: `ParamSet` allows these conflicting parameters to be used safely
651+
/// // by ensuring only one is accessed at a time.
650652
/// EventReader<MyEvent>,
651653
/// EventWriter<MyEvent>,
652-
/// // `&World` reads the entire world, so a `ParamSet` is the only way
653-
/// // that it can be used in the same system as any mutable accesses.
654+
/// // PROBLEM: `&World` needs read access to everything, which conflicts with
655+
/// // any mutable access in the same system.
656+
/// // SOLUTION: `ParamSet` ensures `&World` is only accessed when we're not
657+
/// // using the other mutable parameters.
654658
/// &World,
655659
/// )>,
656660
/// ) {

0 commit comments

Comments
 (0)