Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make 8 methods public and updated input parameter generics for SystemState::build_system_with_input #17034

Merged
merged 9 commits into from
Dec 30, 2024

Conversation

Neo-Zhixing
Copy link
Contributor

Objective

  • Made certain methods public for advanced use cases. Methods that returns mutable references are marked as unsafe due to the possibility of violating internal lifetime constraint assumptions.
  • Fixes an issue introduced by Support systems that take references as input #15184

@@ -396,7 +396,7 @@ macro_rules! impl_build_system {
Input: SystemInput,
Out: 'static,
Marker,
F: FnMut(In<Input>, $(SystemParamItem<$param>),*) -> Out
F: FnMut(Input, $(SystemParamItem<$param>),*) -> Out
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After #15184, the input parameter no longer have to be wrapped in a In

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Can we remove In completely in a follow-up then?

Comment on lines 663 to 665
/// Safety: Modifying the system param states may have unintented consequences.
/// the param state is generally considered to be owned by the [`SystemParam`]. Modifications
/// should respect any invariants as required by the [`SystemParam`].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be helpful to provide an example of when this might be the case, as I'm not sure why it needs to be unsafe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, modifying the system state of ResMut without also updating [SystemMeta::component_access_set] will obviously create issues.

@Neo-Zhixing Neo-Zhixing changed the title Make 8 methods public and updated input lifetime for SystemState::build_system_with_input Make 8 methods public and updated input parameter generics for SystemState::build_system_with_input Dec 30, 2024
@BenjaminBrienen BenjaminBrienen added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 30, 2024
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 30, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 30, 2024
Merged via the queue into bevyengine:main with commit 9cebc66 Dec 30, 2024
32 checks passed
@Neo-Zhixing Neo-Zhixing deleted the rhyolite/expose-internals branch December 31, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants