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

[Merged by Bors] - Add iter_entities to World #6228 #6242

Closed
wants to merge 2 commits into from

Conversation

ramirezmike
Copy link
Contributor

Objective

  • Add a way to iterate over all entities from &World

Solution

  • Added a function iter_entities on World which returns an iterator of Entity derived from the entities in the World's archetypes

Changelog

  • Added a function iter_entities on World, allowing iterating over all entities in contexts where you only have read-only access to the World.

@ramirezmike ramirezmike changed the title Add iter_entities to World (#6228) Add iter_entities to World Oct 12, 2022
@ramirezmike ramirezmike changed the title Add iter_entities to World Add iter_entities to World #6228 Oct 12, 2022
crates/bevy_ecs/src/world/mod.rs Outdated Show resolved Hide resolved
@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A simple quality-of-life change that makes Bevy easier to use labels Oct 12, 2022
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

Nice and thorough tests :) Once the doc nits and the .copied changes are made I'll be happy to approve this.

@alice-i-cecile
Copy link
Member

@ramirezmike once you've made the appropriate changes feel free to resolve the comments :)

@alice-i-cecile alice-i-cecile requested review from harudagondi and mockersf and removed request for harudagondi October 12, 2022 03:11
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Oct 12, 2022
@mockersf
Copy link
Member

Could you use this new function in the scene code from #6227?

@alice-i-cecile
Copy link
Member

Yep, it would be ideal to clean that code up while we're here. If you don't have time, I'll merge this on Monday and make a new easy.

@ramirezmike
Copy link
Contributor Author

Could you use this new function in the scene code from #6227?

I rebased and added a commit to update dynamic_scene.rs to use iter_entities. I know the code is pretty much the same and all the tests pass, but I'll admit, I'm not too familiar with the behavior of dynamic_scene. I ran the scene/scene example before and after the changes and compared the output and it was the same.

Let me know if you'd like me to do more extensive testing though 👍

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

That refactor looks great; that's exactly what I was hoping to see.

@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Oct 17, 2022
# Objective

- Add a way to iterate over all entities from &World

## Solution

- Added a function `iter_entities` on World which returns an iterator of `Entity` derived from the entities in the `World`'s `archetypes`

---

## Changelog

- Added a function `iter_entities` on World, allowing iterating over all entities in contexts where you only have read-only access to the World.
@bors
Copy link
Contributor

bors bot commented Oct 17, 2022

@bors bors bot changed the title Add iter_entities to World #6228 [Merged by Bors] - Add iter_entities to World #6228 Oct 17, 2022
@bors bors bot closed this Oct 17, 2022
@mockersf mockersf added the hacktoberfest-accepted A PR that was accepted for Hacktoberfest, an annual open source event label Oct 17, 2022
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 19, 2022
# Objective

- Add a way to iterate over all entities from &World

## Solution

- Added a function `iter_entities` on World which returns an iterator of `Entity` derived from the entities in the `World`'s `archetypes`

---

## Changelog

- Added a function `iter_entities` on World, allowing iterating over all entities in contexts where you only have read-only access to the World.
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
# Objective

- Add a way to iterate over all entities from &World

## Solution

- Added a function `iter_entities` on World which returns an iterator of `Entity` derived from the entities in the `World`'s `archetypes`

---

## Changelog

- Added a function `iter_entities` on World, allowing iterating over all entities in contexts where you only have read-only access to the World.
Pietrek14 pushed a commit to Pietrek14/bevy that referenced this pull request Dec 17, 2022
# Objective

- Add a way to iterate over all entities from &World

## Solution

- Added a function `iter_entities` on World which returns an iterator of `Entity` derived from the entities in the `World`'s `archetypes`

---

## Changelog

- Added a function `iter_entities` on World, allowing iterating over all entities in contexts where you only have read-only access to the World.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- Add a way to iterate over all entities from &World

## Solution

- Added a function `iter_entities` on World which returns an iterator of `Entity` derived from the entities in the `World`'s `archetypes`

---

## Changelog

- Added a function `iter_entities` on World, allowing iterating over all entities in contexts where you only have read-only access to the World.
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-Usability A simple quality-of-life change that makes Bevy easier to use hacktoberfest-accepted A PR that was accepted for Hacktoberfest, an annual open source event 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.

None yet

4 participants