bevy/crates/bevy_ecs/src
shuo 1dc713b605 add len, is_empty, iter method on SparseSets, make SparseSets inspect… (#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.
2023-02-15 23:52:02 +00:00
..
entity Make EntityRef::new unsafe (#7222) 2023-01-16 22:10:51 +00:00
query Rename Tick::is_older_than to Tick::is_newer_than (#7561) 2023-02-09 16:21:22 +00:00
schedule Simplify generics for the SystemParamFunction trait (#7675) 2023-02-15 19:41:15 +00:00
storage add len, is_empty, iter method on SparseSets, make SparseSets inspect… (#7638) 2023-02-15 23:52:02 +00:00
system Simplify generics for the SystemParamFunction trait (#7675) 2023-02-15 19:41:15 +00:00
world add len, is_empty, iter method on SparseSets, make SparseSets inspect… (#7638) 2023-02-15 23:52:02 +00:00
archetype.rs use bevy_utils::HashMap for better performance. TypeId is predefined … (#7642) 2023-02-15 04:19:26 +00:00
bundle.rs feat: improve initialize_bundle error message (#7464) 2023-02-15 22:56:22 +00:00
change_detection.rs Use a default implementation for set_if_neq (#7660) 2023-02-15 20:10:23 +00:00
component.rs add len, is_empty, iter method on SparseSets, make SparseSets inspect… (#7638) 2023-02-15 23:52:02 +00:00
event.rs Optimize Iterator::count for event iterators (#7582) 2023-02-13 18:20:21 +00:00
lib.rs use bevy_utils::HashMap for better performance. TypeId is predefined … (#7642) 2023-02-15 04:19:26 +00:00
reflect.rs Rename UnsafeWorldCellEntityRef to UnsafeEntityCell (#7568) 2023-02-11 18:50:41 +00:00
removal_detection.rs Add a wrapper around Entity for RemovedComponents (#7503) 2023-02-05 15:37:07 +00:00