-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Add EntityWorldMut::(try_)resource_scope
#20162
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
Add EntityWorldMut::(try_)resource_scope
#20162
Conversation
if world.contains_resource::<EventRegistry>() { | ||
world.resource_scope(|world, mut registry: Mut<EventRegistry>| { | ||
registry.run_updates(world, *last_change_tick); | ||
world.try_resource_scope(|world, mut registry: Mut<EventRegistry>| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite see how this change was necessary for this PR? That said it's a good change, so I'm happy to keep it :)
}; | ||
update_transform(); | ||
}); | ||
// FIXME: Replace this closure with a `try` block. See: https://github.com/rust-lang/rust/issues/31436. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to this file similarly seem unrelated, but I also like the cleanup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very solid implementation, tested, documented and something that we definitely want.
I don't love tackling cleanup in the same PR, but I won't look a gift horse in the mouth. The cleanup is vaguely related, and well done; might as well merge it.
My only blocking complaint is that I feel strongly that the TODOs in bevy_transform should not be done; we should remove them.
Yeah, it's just easy opportunistic stuff I noticed while looking at the |
Objective
Fixes #20139
Solution
Implement the methods, and leverage them where applicable
Testing
Added unit tests
Showcase
becomes