bevy/crates/bevy_scene/src
BD103 04ceb46fe0
Use EntityHashMap for EntityMapper (#10415)
# Objective

- There is a specialized hasher for entities:
[`EntityHashMap`](https://docs.rs/bevy/latest/bevy/utils/type.EntityHashMap.html)
- [`EntityMapper`] currently uses a normal `HashMap<Entity, Entity>`
- Fixes #10391

## Solution

- Replace the normal `HashMap` with the more performant `EntityHashMap`

## Questions

- This does change public API. Should a system be implemented to help
migrate code?
  - Perhaps an `impl From<HashMap<K, V, S>> for EntityHashMap<K, V>`
- I updated to docs for each function that I changed, but I may have
missed something

---

## Changelog

- Changed `EntityMapper` to use `EntityHashMap` instead of normal
`HashMap`

## Migration Guide

If you are using the following types, update their listed methods to use
the new `EntityHashMap`. `EntityHashMap` has the same methods as the
normal `HashMap`, so you just need to replace the name.

### `EntityMapper`

- `get_map`
- `get_mut_map`
- `new`
- `world_scope`

### `ReflectMapEntities`

- `map_all_entities`
- `map_entities`
- `write_to_world`

### `InstanceInfo`

- `entity_map`
  - This is a property, not a method.

---

This is my first time contributing in a while, and I'm not familiar with
the usage of `EntityMapper`. I changed the type definition and fixed all
errors, but there may have been things I've missed. Please keep an eye
out for me!
2023-11-07 08:23:04 +00:00
..
bundle.rs Finish documenting bevy_scene (#9949) 2023-10-01 17:54:19 +00:00
dynamic_scene_builder.rs Make builder types take and return Self (#10001) 2023-10-09 19:46:17 +00:00
dynamic_scene.rs Use EntityHashMap for EntityMapper (#10415) 2023-11-07 08:23:04 +00:00
lib.rs Finish documenting bevy_scene (#9949) 2023-10-01 17:54:19 +00:00
scene_filter.rs Make builder types take and return Self (#10001) 2023-10-09 19:46:17 +00:00
scene_loader.rs Correct Scene loader error description (#10161) 2023-10-17 17:58:35 +00:00
scene_spawner.rs Use EntityHashMap for EntityMapper (#10415) 2023-11-07 08:23:04 +00:00
scene.rs Use EntityHashMap for EntityMapper (#10415) 2023-11-07 08:23:04 +00:00
serde.rs Use EntityHashMap for EntityMapper (#10415) 2023-11-07 08:23:04 +00:00