bevy/crates/bevy_ecs/src/storage
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
..
blob_vec.rs Add safety comments to usages of byte_add (Ptr, PtrMut, OwningPtr) (#7214) 2023-01-16 20:35:15 +00:00
mod.rs Panic on dropping NonSend in non-origin thread. (#6534) 2023-01-09 20:40:34 +00:00
resource.rs Add World::clear_resources & World::clear_all (#3212) 2023-01-17 04:20:42 +00:00
sparse_set.rs add len, is_empty, iter method on SparseSets, make SparseSets inspect… (#7638) 2023-02-15 23:52:02 +00:00
table.rs add len, is_empty, iter method on SparseSets, make SparseSets inspect… (#7638) 2023-02-15 23:52:02 +00:00