bevy/crates/bevy_reflect/src/impls
TheBigCheese 3d3444b981 impl Reflect for std::collections::HashMap instead of only bevy::utils::HashMap (#7739) (#7782)
# Objective

Implement `Reflect` for `std::collections::HashMap<K, V, S>` as well as `hashbrown::HashMap<K, V, S>` rather than just for `hashbrown::HashMap<K, V, RandomState>`. Fixes #7739.

## Solution

Rather than implementing on `HashMap<K, V>` I instead implemented most of the related traits on `HashMap<K, V, S> where S: BuildHasher + Send + Sync + 'static` and then `FromReflect` also needs the extra bound `S: Default` because it needs to use `with_capacity_and_hasher` so needs to be able to generate a default hasher.

As the API of `hashbrown::HashMap` is identical to `collections::HashMap` making them both work just required creating an `impl_reflect_for_hashmap` macro like the `impl_reflect_for_veclike` above and then applying this to both HashMaps.

---

## Changelog

`std::collections::HashMap` can now be reflected. Also more `State` generics than just `RandomState` can now be reflected for both `hashbrown::HashMap` and `collections::HashMap`
2023-02-27 21:37:36 +00:00
..
glam.rs Make proc macros hygienic in bevy_reflect_derive (#6752) 2022-12-05 23:39:44 +00:00
rect.rs Make proc macros hygienic in bevy_reflect_derive (#6752) 2022-12-05 23:39:44 +00:00
smallvec.rs bevy_reflect: Decouple List and Array traits (#7467) 2023-02-13 21:07:53 +00:00
std.rs impl Reflect for std::collections::HashMap instead of only bevy::utils::HashMap (#7739) (#7782) 2023-02-27 21:37:36 +00:00