bevy/crates/bevy_platform_support/src
krunchington e5158ed96c
Update docs to explain default Hasher issue (#18350)
# Objective

I experienced an issue where `HashMap::new` was not returning a value
typed appropriately for a `HashMap<K,V>` declaration that omitted the
Hasher- e.g. the Default Hasher for the type is different than what the
`new` method 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 the `hashbrown` implementation. 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 if `hashbrown`
isn't actually implementing the new or something?

## Testing

n/a although I did generate and open the docs on my Ubuntu machine.

---

## Showcase

before:

![image](https://github.com/user-attachments/assets/5c80417d-9c4e-4b57-825f-911203ed8558)

after:

![image](https://github.com/user-attachments/assets/420f6775-2f32-466f-a580-bb1344016bda)

---------

Co-authored-by: Zachary Harrold <zac@harrold.com.au>
2025-03-17 23:25:52 +00:00
..
sync Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
time Support for non-browser wasm (#17499) 2025-03-07 21:22:28 +00:00
collections.rs Update docs to explain default Hasher issue (#18350) 2025-03-17 23:25:52 +00:00
hash.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
lib.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00