bevy/crates/bevy_ecs/src/system
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
..
commands.rs Make Command's public? (#2034) 2021-04-28 20:08:33 +00:00
exclusive_system.rs Make Commands and World apis consistent (#1703) 2021-03-23 00:23:40 +00:00
into_system.rs Allows a number of clippy lints and fixes 2 (#1999) 2021-05-14 20:37:32 +00:00
mod.rs allow up to 16 parameters for systems (#1805) 2021-04-03 23:13:54 +00:00
query.rs Add a method iter_combinations on query to iterate over combinations of query results (#1763) 2021-05-17 23:33:47 +00:00
system.rs Cargo fmt with unstable features (#1903) 2021-04-21 23:19:34 +00:00
system_chaining.rs Improve bevy_ecs::system module docs (#1932) 2021-04-15 20:36:16 +00:00
system_param.rs Impl AsRef+AsMut for Res, ResMut, and Mut (#2189) 2021-05-17 23:07:19 +00:00