bevyengine / bevyengine/bevy

Add support for iter_permutation?

Open
#6,293 1 comment 2 reactions 0 assignees View on GitHub
A-ECS C-Usability
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
4d 8m
Merged PRs (30d)
147

Description

## What problem does this solve or what need does it fill?
I was creating a system of "gravity" where every physical body in the game affects everything else, and needs an equivalent of a double for loop that acesses each pairs twice with a different order.
## What solution would you like?
Adding an `iter_permutation`, `iter_permutation_mut` method that iterates over all permutations of a query object, alongside `iter_combinations`.
## What alternative(s) have you considered?
Currently we already have `iter_combinations`, and used with `iter_tools`, we can achieve the same effect even for cases larger than 2, but since we already have `iter_combinations`, having a permutation method seems to make it look slightly more symmetric.
## Additional context
(None).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.