Manual SystemState + SystemMeta ref methods #12745
Open
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
Currently SystemMeta's private fields and the extensive unsafe code for dealing with SystemParams make custom system implementations unwieldy. One particular area this pops up is when trying to use dynamic queries with normal systems.
Solution
Allow users to specify parameters in SystemState that require explicit state initialization, and expose some readonly SystemMeta fields.
Changelog
Add additional type parameter
Extra
to SystemStateadd
new_with_extra()
,get_with_extra()
,get_mut_with_extra()
,get_unchecked_with_extra()
,get_unchecked_mut_with_extra()
, andfetch_with_extra()
to SystemState (names verbose to not conflict with existing code)add
component_access(&self)
,archetype_component_access(&self)
, andraw_name(&self)
to SystemMeta