Reflect for HashMap with different hashers (NoHashHasher u64)
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Using stable hashes allows outside tools to edit data files while keeping save gaves and state consistent. Adding Reflect (or a way to enable it manually) to custom data types gives some additional features like working with egui_inspector_gui and possibly other tools.
## What solution would you like?
```#[derive(Reflect)]``` working with NoHashHasher would be easiest, but the ability to use it for other hashers would be beneficial.
## Additional context
```
error[E0277]: the trait bound `BuildHasherDefault>: TypePath` is not satisfied
--> src\items\components.rs:137:16
|
137 | pub items: HashMap>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TypePath` is not implemented for `BuildHasherDefault>`
|
= help: the trait `TypePath` is implemented for `BuildHasherDefault`
= note: required for `std::collections::HashMap>>` to implement `TypePath`
note: required by a bound in `NamedField::new`
--> C:\Users\Joey\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_reflect-0.12.0\src\fields.rs:16:29
|
16 | pub fn new(name: &'static str) -> Self {
| ^^^^^^^^ required by this bound in `NamedField::new`
```
Macros are out of my depth, but if I can help in any way let me know!
Contributor guide
Research direction
Start with the bevy_reflect-0.12.0 fields.rs error location and the reflection support involved in std::collections::HashMap. Use src/items/components.rs as the example that currently fails with BuildNoHashHasher. Done means deriving Reflect works for HashMap fields using NoHashHasher, or another documented manual path supports custom hashers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100