Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drain query #97

Open
Anders429 opened this issue Aug 25, 2022 · 0 comments
Open

Drain query #97

Anders429 opened this issue Aug 25, 2022 · 0 comments
Labels
A - Querying Area: Querying components of entities. C - Enhancement Category: New feature or request. P - Low Priority: Not particularly urgent. S - Needs Investigation Status: Further investigation is needed.

Comments

@Anders429
Copy link
Owner

Anders429 commented Aug 25, 2022

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.

@Anders429 Anders429 added C - Enhancement Category: New feature or request. S - Needs Investigation Status: Further investigation is needed. P - Low Priority: Not particularly urgent. A - Querying Area: Querying components of entities. labels Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A - Querying Area: Querying components of entities. C - Enhancement Category: New feature or request. P - Low Priority: Not particularly urgent. S - Needs Investigation Status: Further investigation is needed.
Projects
None yet
Development

No branches or pull requests

1 participant