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
ecs_guide.rs
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
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
query_bundle.rs Adding WorldQuery for WithBundle (#2024) 2021-04-28 21:03:10 +00:00
removal_detection.rs
startup_system.rs
state.rs
system_chaining.rs
system_param.rs
system_sets.rs Add system sets and run criteria example (#1909) 2021-04-23 19:08:16 +00:00
timers.rs