Skip to content

Support reflection-based serialization on bundled hash set implementations #14612

Open

Description

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

Bevy bundles a few hash map / hash set implementations suitable for games (i.e. performant above all else) publicly in bevy_utils. Currently it's a combination of hashbrown (an implementation of the awesome abseil swisstables) and a fast hashing algorithm. However, the hash map does not support reflection serialization (does not implement the relevant traits), which makes it impossible to use with moonshine_save (or any other reflection-based save/load system).

What solution would you like?

Just implement Serialize/Deserialize on HashMap and HashSet. hashbrown already has the relevant serde implementations, so there is no technical reason why this shouldn't work (hand off to the serde implementation for both serializing and deserializing).

What alternative(s) have you considered?

Not sure if there is an elegant workaround, the reflection system is so opaque to me that I can't figure out how to implement ReflectSerialize (or any other trait, idk) for HashSet. I'd appreciate one, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-ReflectionRuntime information about typesC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-UncontroversialThis work is generally agreed upon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions