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.
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
[Merged by Bors] - Extract Resources into their own dedicated storage #4809
[Merged by Bors] - Extract Resources into their own dedicated storage #4809
Changes from 9 commits
7cd3e3f
76ede2f
b7b16be
5464d47
32c5456
bb9a49f
b719c1b
99f14d7
4918e10
2b24bac
ab675d1
bd25ccc
70578fe
27ce1a3
520fd30
7737705
a6b5e4b
610c617
e32ec9e
515e2b3
c1f1133
850b318
a0731e6
f4123b9
bb38531
bb59857
3556580
734584d
01c176f
58027c4
d3d846a
40afd47
7b9fbf0
a6c8977
39be822
efd5113
535bc9f
7932fa8
c2476ed
31cd2b4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 think this method needs some comments as it diverges a lot behaviour wise from what is typically "expected" from inserting into a collection. When inserting into a collection I would expect the
Option
return type to mean whether a component was already present andSome
would return the data if it was already present. But here we:None
ifcomponent_id
doesnt exist in theresources
hashmap (which would be reasonable to expect to get added in this function rather than inWorld::initialize_resource_internal
)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.
After realizing that this is pretty badly structured for external consumers of this API, I reworked the overall structure of the API to make this a bit easier to work with. Users will now need to either
get_mut
orinitialize_with
aResourceInfo
and then write to it, withResourceInfo
ensuring the invariant of "zero or one" elements is maintained. This has the added benefit of removing pretty much all references ofColumn
related to resources from non-storage code. The safety comment should more accurately reflect what's needed here too.