bevy/crates/bevy_ecs/src/system
Giacomo Stevanato 7de271f992
Add FilteredAccess::empty and simplify the implementatin of update_component_access for AnyOf/Or (#14352)
# Objective

- The implementation of `update_component_access` for `AnyOf`/`Or` is
kinda weird due to special casing the first filter, let's simplify it;
- Fundamentally we want to fold/reduce the various filters using an OR
operation, however in order to do a proper fold we need a neutral
element for the initial accumulator, which for OR is FALSE. However we
didn't have a way to create a `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 https://github.com/bevyengine/bevy/pull/14026

## Solution

- Introduce `FilteredAccess::empty` as a way to create a
`FilteredAccess` corresponding to the logical proposition FALSE;
- Use it as the initial accumulator for the above operations, allowing
to handle all the elements to fold in the same way.

---

## Migration Guide

- The behaviour of `AnyOf<()>` and `Or<()>` has been changed to match no
archetypes rather than all archetypes to naturally match the
corresponding logical operation. Consider replacing them with `()`
instead.
2024-07-29 23:20:06 +00:00
..
commands Add insert_by_id and try_insert_by_id to EntityCommands (#14283) 2024-07-15 23:29:13 +00:00
adapter_system.rs Generalised ECS reactivity with Observers (#10839) 2024-06-15 01:33:26 +00:00
builder.rs Implement a SystemBuilder for building SystemParams (#13123) 2024-05-22 00:58:37 +00:00
combinator.rs Generalised ECS reactivity with Observers (#10839) 2024-06-15 01:33:26 +00:00
exclusive_function_system.rs Require &mut self for World::increment_change_tick (#14459) 2024-07-24 12:42:28 +00:00
exclusive_system_param.rs Add on_unimplemented Diagnostics to Most Public Traits (#13347) (#13662) 2024-06-04 00:31:34 +00:00
function_system.rs Make names of closure systems changable (#14369) 2024-07-18 18:07:47 +00:00
mod.rs Add FilteredAccess::empty and simplify the implementatin of update_component_access for AnyOf/Or (#14352) 2024-07-29 23:20:06 +00:00
observer_system.rs Allow observer systems to have outputs (#14159) 2024-07-15 14:59:12 +00:00
query.rs Fix typo in Query::single_mut docs (#13916) 2024-06-18 19:55:37 +00:00
system_name.rs Make names of closure systems changable (#14369) 2024-07-18 18:07:47 +00:00
system_param.rs Fixed #14248 and other URL issues (#14276) 2024-07-11 12:01:49 +00:00
system_registry.rs Don't debug SystemId's entity field twice (#14499) 2024-07-27 16:15:39 +00:00
system.rs Generalised ECS reactivity with Observers (#10839) 2024-06-15 01:33:26 +00:00