bevy_pkv
bevy_pkv copied to clipboard
Can't serialize maps with non-String keys on wasm
Attempting to serialize a HashMap with non-string keys results an error in wasm (but works on native). This appears to be an intentional limitation of serde_json. It would be nice if bevy_pkv used a storage method that did not have this limitation. Since the native version uses rmp-serde, maybe just use that + base64 for wasm?
Yes, that sounds like an unnecessary limitation. It would break data for any users upgrading, but I think I'm ok with that.
Must remember to put it in the release notes
There is also a request to store using serde_json on native for (human readableness #55 ), perhaps it would make sense to have it as a feature flag, affecting both platforms.
It would be nice to have a lower-level interface that deals with u8 slices and strs directly, in case users want to choose their serialization method. The higher-level interface that uses rmp-serde or serde-json could exist on top of that.