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

Add rmpv::ext::to_value_named to keep struct keys #337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

julienvincent
Copy link

The current rmpv::ext::to_value implementation turns Structs into Value::Array<Value::String> which is not deserializable by other languages.

Technically I would call this a bug and opt to change the existing to_value implementation, but to stay cautious of not breaking existing users' code I think it makes sense to introduce a new to_value_named fn which instead turns Structs into Value::Map and maintains their keys.

Fixes #190

rmpv/src/ext/se.rs Outdated Show resolved Hide resolved
The current `rmpv::ext::to_value` implementation turns Structs into
`Value::Array<Value::String>` which is not deserializable by other
languages.

Technically I would call this a bug and opt to change the existing
`to_value` implementation, but to stay cautious of not breaking existing
users' code I think it makes sense to introduce a new `to_value_named`
fn which instead turns Structs into `Value::Map` and maintains their
keys.
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

Successfully merging this pull request may close these issues.

Serializing custom types into Value, allow named Map instead of Array representation
2 participants