bevy/examples/ecs
Paweł Grabarz a81fb7aa7e Add a method iter_combinations on query to iterate over combinations of query results (#1763)
Related to [discussion on discord](https://discord.com/channels/691052431525675048/742569353878437978/824731187724681289)

With const generics, it is now possible to write generic iterator over multiple entities at once.

This enables patterns of query iterations like

```rust
for [e1, e2, e3] in query.iter_combinations() {
   // do something with relation of all three entities
}
```

The compiler is able to infer the correct iterator for given size of array, so either of those work
```rust
for [e1, e2] in query.iter_combinations()  { ... }
for [e1, e2, e3] in query.iter_combinations()  { ... }
```

This feature can be very useful for systems like collision detection.

When you ask for permutations of size K of N entities:
- if K == N, you get one result of all entities
- if K < N, you get all possible subsets of N with size K, without repetition
- if K > N, the result set is empty (no permutation of size K exist)

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-05-17 23:33:47 +00:00
..
change_detection.rs Make Commands and World apis consistent (#1703) 2021-03-23 00:23:40 +00:00
ecs_guide.rs Add LogPlugin, otherwise the ambiguity detector doesn't work. (#1740) 2021-03-23 20:29:28 +00:00
event.rs add documentation on LogPlugin and more log usage (#1973) 2021-04-22 23:30:48 +00:00
fixed_timestep.rs add documentation on LogPlugin and more log usage (#1973) 2021-04-22 23:30:48 +00:00
hierarchy.rs Make Commands and World apis consistent (#1703) 2021-03-23 00:23:40 +00:00
iter_combinations.rs Add a method iter_combinations on query to iterate over combinations of query results (#1763) 2021-05-17 23:33:47 +00:00
parallel_query.rs Make Commands and World apis consistent (#1703) 2021-03-23 00:23:40 +00:00
query_bundle.rs Adding WorldQuery for WithBundle (#2024) 2021-04-28 21:03:10 +00:00
removal_detection.rs Make Commands and World apis consistent (#1703) 2021-03-23 00:23:40 +00:00
startup_system.rs Adopt a Fetch pattern for SystemParams (#1074) 2020-12-15 21:57:16 -08:00
state.rs Fix the left/right movement direction in state example. (#1879) 2021-04-14 23:39:56 +00:00
system_chaining.rs format comments (#1612) 2021-03-11 00:27:30 +00:00
system_param.rs Allow deriving SystemParam on private types (#1936) 2021-04-16 18:40:49 +00:00
system_sets.rs Add system sets and run criteria example (#1909) 2021-04-23 19:08:16 +00:00
timers.rs Make Commands and World apis consistent (#1703) 2021-03-23 00:23:40 +00:00