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

Implement Reflect for EntityHashMap #11117

Closed
TheButlah opened this issue Dec 28, 2023 · 1 comment · Fixed by #11195
Closed

Implement Reflect for EntityHashMap #11117

TheButlah opened this issue Dec 28, 2023 · 1 comment · Fixed by #11195
Labels
A-Reflection Runtime information about types C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@TheButlah
Copy link

What problem does this solve or what need does it fill?

Improves ergonomics of EntityHashMap

What solution would you like?

EntityHashMap should implement Reflect.

Additional context

#[derive(Resource, Debug, Reflect, Default)]
pub struct EntityMapper {
	dm_to_world: bevy::utils::EntityHashMap<Entity, Entity>,
}

gives error:

1. the trait bound `EntityHash: TypePath` is not satisfied
   the following other types implement trait `TypePath`:
     bool
     char
     isize
     i8
     i16
     i32
     i64
     i128
   and 380 others
   required for `bevy::utils::hashbrown::HashMap<bevy::prelude::Entity, bevy::prelude::Entity, EntityHash>` to implement `TypePath`
   see issue #48214 [E0277]
@TheButlah TheButlah added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Dec 28, 2023
@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Reflection Runtime information about types and removed C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 1, 2024
@Adamkob12
Copy link
Contributor

I would like to solve this.

github-merge-queue bot pushed a commit that referenced this issue Jan 4, 2024
# Objective

- Fix #11117 by implementing `Reflect` for `EntityHashMap`

## Solution

- By implementing `TypePath` for `EntityHash`, Bevy will automatically
implement `Reflect` for `EntityHashMap`

---

## Changelog

- `TypePath` is implemented for `EntityHash`
- A test called `entity_hashmap_should_impl_reflect` was created to
verify that #11117 was solved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants