Add OptionalSystemParam and OptionalSystemParamFetch trait#6854
Add OptionalSystemParam and OptionalSystemParamFetch trait#6854JonahPlusPlus wants to merge 18 commits intobevyengine:mainfrom
OptionalSystemParam and OptionalSystemParamFetch trait#6854Conversation
|
@james7132 I have a solution for your concern. You can check out the PR on my fork here. Basically, the idea is to implement Implementing If this is acceptable to you, I'll merge it to this PR. |
Indepth Optional System Params
Update system_param.rs
OptionalSystemParam traitOptionalSystemParam and OptionalSystemParamFetch trait
|
@alice-i-cecile I'm closing this PR because I want to redo it once #6865 is merged (if you could review and merge it that would be appreciated). With the simplified trait structure, it will be easier to add
This gives users precise control over error handling. |
Objective
SystemParamforOption<T>, due to orphan rules.Solution
SystemParamforOption<T>, users can implementOptionalSystemParamforTandOptionalSystemParamFetchforTState.SystemParamis implemented for allOption<T: OptionalSystemParam.Changelog
OptionalSystemParamandOptionalSystemParamFetch.Option<T>system params to useOptionalSystemParamandOptionalSystemParamFetch.