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
Resource
for()
#14640Solution
Resource
for (), like the first version of Draft: ImplementResource
for()
#14877Note that this PR doesn't implement ReflectResource for Unit type: There isn't much a reason to do so.
This can only affect you if you need to use () more than a resource, using it as a Reflected Resource too.
Testing
Showcase
Notes
Comments in #14877 suggests adding a
MaybeResource
type query.Even so, its simpler and more ergonomic IMO to just implement
()
as a Resource, so you can use default types without having to create ZST to do this work for you. But have the drawback of you having to use Option to intermediate between a type that exists in the world, or the dummy () type.World::resource::<()> will not work: () isn't really inserted in the World, instead you should use Option or get_resource() to help you here.