Deprecate panicking .resource methods#18084
Closed
alice-i-cecile wants to merge 1 commit intobevyengine:mainfrom
Closed
Deprecate panicking .resource methods#18084alice-i-cecile wants to merge 1 commit intobevyengine:mainfrom
.resource methods#18084alice-i-cecile wants to merge 1 commit intobevyengine:mainfrom
Conversation
Member
Author
|
We could choose to use a lint for these methods and keep them around (see TheBevyFlock/bevy_cli#269) and keep them around, but I prefer the solution here because:
|
Contributor
|
This is going to make a lot of rendering code worse :/ (check how often |
Member
Author
|
Yeah, I think that's reasonable. Given that we're not running into many panics here (and Bevy already panics when you're missing a resource in a normal system) I think this is net-negative. Closing out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
This PR is a sibling to #18082, and almost all of the motivation there applies here. These methods are much more commonly used in commands, tests and exclusive systems though, and deserve their own judgement call.
Ultimately part of #14275.
Solution
I'm less confident about this PR, and there's 796 warnings in my IDE, so I want to get consensus before burning time on migrating all of these.
TODO:
World::resourceand friends return aResultfor nicer?ergonomics?Future Work
Move the non-panicking versions to the better names during the 0.17 cycle, just like in #18082.
Migration Guide
World::resourceand all related methods are now deprecated. UseWorld::get_resourceand so on and handle the returnedOption.