You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem does this solve or what need does it fill?
The Option<Res<T>> implementation is very convenient to improve robustness when a resource may or may not exist.
We currently have special-cased impls for this for Res, ResMut, NonSend and NonsendMut.
Other system parameters (like EventWriter) are not supported. This is particularly frustrating for third-party system param, as orphan rules prevent users from writing their own.
What solution would you like?
Replacing the existing manual implementations with a blanket impl for all SystemParam.
What alternative(s) have you considered?
Add manual impls for all of Bevy's first-party system param. This is more boilerplate, doesn't help external system param types, and doesn't play nice with generic code.
Note that some system param (like Entities) will always exist, so this approach does reduce the footgun potential.
#7162 and #8196 attempt to tackle a similar space, through the addition of an additional FallibleSystemParam trait that allows for users to bypass the orphan rule.
What problem does this solve or what need does it fill?
The
Option<Res<T>>
implementation is very convenient to improve robustness when a resource may or may not exist.We currently have special-cased impls for this for
Res
,ResMut
,NonSend
andNonsendMut
.Other system parameters (like
EventWriter
) are not supported. This is particularly frustrating for third-party system param, as orphan rules prevent users from writing their own.What solution would you like?
Replacing the existing manual implementations with a blanket impl for all
SystemParam
.What alternative(s) have you considered?
Add manual impls for all of Bevy's first-party system param. This is more boilerplate, doesn't help external system param types, and doesn't play nice with generic code.
Note that some system param (like
Entities
) will always exist, so this approach does reduce the footgun potential.Additional context
Raised on Discord.
The text was updated successfully, but these errors were encountered: