Skip to content

Revive iter_entities() when you only have immutable World access ❤️‍🩹 #22864

Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom
kfc35:22657-read_only_world_iter_entities
Feb 8, 2026
Merged

Revive iter_entities() when you only have immutable World access ❤️‍🩹 #22864
alice-i-cecile merged 1 commit intobevyengine:mainfrom
kfc35:22657-read_only_world_iter_entities

Conversation

@kfc35
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 commented Feb 8, 2026

Objective

Solution

  • Exhumes what was previously deprecated and deleted 🧟. iter_entities() is back as an ergonomic way to non-fallibly iterate through all the entities when you only have immutable World access.
  • I didn’t implement iter_entities() on Entities because it seems deliberate from conversation in Add an Entities::iter() method to iterate over all entities when you only have &World #6228 … although I could be convinced otherwise if the conversation is outdated.

Testing

  • I exhumed the previous ci test

@kfc35 kfc35 added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 8, 2026
Copy link
Copy Markdown
Contributor

@ElliottjPierce ElliottjPierce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! And yeah, this has to be on the World. The Entities type doesn't have strong access to what entities are not freed.

@ElliottjPierce ElliottjPierce added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 8, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Feb 8, 2026
Merged via the queue into bevyengine:main with commit c325529 Feb 8, 2026
49 checks passed
@kfc35 kfc35 deleted the 22657-read_only_world_iter_entities branch February 21, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore read-only World::iter_entities or provide infallible equivalent

4 participants