Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't serialize maps with non-String keys on wasm #62

Open
dgulotta opened this issue Dec 9, 2024 · 3 comments
Open

Can't serialize maps with non-String keys on wasm #62

dgulotta opened this issue Dec 9, 2024 · 3 comments

Comments

@dgulotta
Copy link

dgulotta commented Dec 9, 2024

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?

@johanhelsing
Copy link
Owner

johanhelsing commented Dec 17, 2024

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

@johanhelsing
Copy link
Owner

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.

@dgulotta
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants