-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add FilteredAccess::empty
and simplify the implementatin of update_component_access
for AnyOf
/Or
#14352
Add FilteredAccess::empty
and simplify the implementatin of update_component_access
for AnyOf
/Or
#14352
Conversation
9d814d4
to
a7b3a88
Compare
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.
This makes those implementations much clearer!
2291bf7
to
2a23d74
Compare
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.
Does this change the behavior of Or<()>
? The old code seems to be a no-op while the new code seems to remove all filter_sets
. Mostly from a breaking changes standpoint.
Yes, this is already mentioned in the migration guide. I could avoid this breaking change by adding a bit of complexity in the code, but the current behaviour seems wrong to me so this is also an occasion to fix it. |
Objective
update_component_access
forAnyOf
/Or
is kinda weird due to special casing the first filter, let's simplify it;FilteredAccess
value corresponding to FALSE and thus the only option was reducing, which special cases the first element as being the initial accumulator.This is an alternative to #14026
Solution
FilteredAccess::empty
as a way to create aFilteredAccess
corresponding to the logical proposition FALSE;Migration Guide
AnyOf<()>
andOr<()>
has been changed to match no archetypes rather than all archetypes to naturally match the corresponding logical operation. Consider replacing them with()
instead.