Anders429 / Anders429/brood

Drain query

Aperta
#97 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
A - Querying C - Enhancement P - Low S - Needs Investigation
Lingua principale
Rust
Stelle
41
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Related to #59 in that it's another collection method.

The idea is to add a method named `drain` that returns an iterator over the queried entities, removing them from the `World` at the same time. The signature of the method would be the same as that of `query`, with views and a filter.

Care would need to be taken to remove the entities from the entity allocator as well. The drain can also return entity identifiers, but they will not be valid anymore, which will be indicated by their generations. The documentation should note this.

The returned iterator could have a reference to the actual archetypes in-memory to facilitate the iteration, similar to how, say, `HashSet`'s `drain` method works.

Note that the returned entities shouldn't be references, but could instead be the values directly moved, since they will no longer exists in their archetypes after iteration.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.