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 len, is_empty, iter method on SparseSets, make SparseSets inspect… #7638

Closed
wants to merge 9 commits into from

Conversation

shuoli84
Copy link
Contributor

…able like Table. Rename clear to clear_entities to clarify that metadata keeps, only value cleared

Objective

  • Provide some inspectability for SparseSets.

Solution

  • Tables has these three methods, len, is_empty and iter too. Add these methods to SparseSets, so user can print the shape of storage.

Changelog

This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section.

  • Add len, is_empty, iter methods on SparseSets.
  • Rename clear to clear_entities to clarify its purpose.
  • Add new_for_test on ComponentInfo to make test code easy.
  • Add test case covering new methods.

Migration Guide

This section is optional. If there are no breaking changes, you can delete this section.

  • Simply adding new functionality is not a breaking change.

…able like Table. Rename clear to clear_entities to clarify that metadata keeps, only value cleared
@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 Feb 12, 2023
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.

Simple and useful. Adds more docs!

@alice-i-cecile
Copy link
Member

Comments on the docs are just nits, but do help clean things up a bit.

crates/bevy_ecs/src/component.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/storage/sparse_set.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/storage/sparse_set.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/storage/sparse_set.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/storage/sparse_set.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/storage/sparse_set.rs Outdated Show resolved Hide resolved
@james7132 james7132 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 Feb 15, 2023
@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Feb 15, 2023
#7638)

…able like Table. Rename clear to clear_entities to clarify that metadata keeps, only value cleared

# Objective

- Provide some inspectability for SparseSets. 

## Solution

- `Tables` has these three methods, len, is_empty and iter too. Add these methods to `SparseSets`, so user can print the shape of storage.

---

## Changelog

> This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section.

- Add `len`, `is_empty`, `iter` methods on SparseSets.
- Rename `clear` to `clear_entities` to clarify its purpose.
- Add `new_for_test` on `ComponentInfo` to make test code easy.
- Add test case covering new methods.

## Migration Guide

> This section is optional. If there are no breaking changes, you can delete this section.

- Simply adding new functionality is not a breaking change.
@bors bors bot changed the title add len, is_empty, iter method on SparseSets, make SparseSets inspect… [Merged by Bors] - add len, is_empty, iter method on SparseSets, make SparseSets inspect… Feb 16, 2023
@bors bors bot closed this Feb 16, 2023
myreprise1 pushed a commit to myreprise1/bevy that referenced this pull request Feb 16, 2023
bevyengine#7638)

…able like Table. Rename clear to clear_entities to clarify that metadata keeps, only value cleared

# Objective

- Provide some inspectability for SparseSets. 

## Solution

- `Tables` has these three methods, len, is_empty and iter too. Add these methods to `SparseSets`, so user can print the shape of storage.

---

## Changelog

> This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section.

- Add `len`, `is_empty`, `iter` methods on SparseSets.
- Rename `clear` to `clear_entities` to clarify its purpose.
- Add `new_for_test` on `ComponentInfo` to make test code easy.
- Add test case covering new methods.

## Migration Guide

> This section is optional. If there are no breaking changes, you can delete this section.

- Simply adding new functionality is not a breaking change.
myreprise1 pushed a commit to myreprise1/bevy that referenced this pull request Feb 16, 2023
bevyengine#7638)

…able like Table. Rename clear to clear_entities to clarify that metadata keeps, only value cleared

# Objective

- Provide some inspectability for SparseSets. 

## Solution

- `Tables` has these three methods, len, is_empty and iter too. Add these methods to `SparseSets`, so user can print the shape of storage.

---

## Changelog

> This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section.

- Add `len`, `is_empty`, `iter` methods on SparseSets.
- Rename `clear` to `clear_entities` to clarify its purpose.
- Add `new_for_test` on `ComponentInfo` to make test code easy.
- Add test case covering new methods.

## Migration Guide

> This section is optional. If there are no breaking changes, you can delete this section.

- Simply adding new functionality is not a breaking change.
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 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