Update docs to explain default Hasher issue#18350
Update docs to explain default Hasher issue#18350alice-i-cecile merged 5 commits intobevyengine:mainfrom
Conversation
bushrat011899
left a comment
There was a problem hiding this comment.
Just some slight changes to wording and formatting. Unless Bevy wants to new-type HashMap/HashSet I agree this is the best we can do to document the issue.
Co-authored-by: Zachary Harrold <[email protected]>
Co-authored-by: Zachary Harrold <[email protected]>
|
I committed the suggested changes but I suspect the docs CI will fail on the |
|
NVM it was the example with imports. Should be fixed now though I had to put a dev dependency on bevy_ecs |
|
CI is upset at you:
This needs to be fixed before we can merge. |
Damn I knew I should have checked how other crates pulled internal dependencies and not yolo'd it. Should be fixed now! |
This reverts commit e5158ed.
Objective
I experienced an issue where
HashMap::newwas not returning a value typed appropriately for aHashMap<K,V>declaration that omitted the Hasher- e.g. the Default Hasher for the type is different than what thenewmethod produces.After discussion on discord, this appears to be an issue in
hashbrown, and working around it would be very nontrivial, requiring a newtype on top of thehashbrownimplementation. Rather than doing that, it was suggested that we add docs to make the issue more visible and provide a clear workaround.Solution
Updated the docs for
bevy_platform_support::collections. I couldn't update Struct docs because they're re-exports, so I had to settle for the module.Note that the
[HashMap::new]link wasn't generating properly- I'm not sure why. I see the method in the docs.rs site, https://docs.rs/hashbrown/0.15.1/hashbrown/struct.HashMap.html#method.new, but not on the generated internal documentation. I wonder ifhashbrownisn't actually implementing the new or something?Testing
n/a although I did generate and open the docs on my Ubuntu machine.
Showcase
before:

after:
