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

Valuable bridge for serde_json::Value #61

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sunng87
Copy link
Contributor

@sunng87 sunng87 commented Jul 19, 2021

This patch provides an implementation of Valuable for serde_json::Value. I'm opening this as a demo of implementing Valuable on a complex data type. This is better to be placed in serde_json crate when valuable released on crates.io. So it's not necessarily to be merged.

The reason why it is implemented in valueable crate is because an external one requires wrapper type over serde_json::Value. Furthermore, for collection types it may bring in additional allocation.

The second part is about the choice between Mappable and Structable for serde_json::Map. Using Mappable is straight-forward but it's lack of key access. Creating StructDef from the map might not be possible because of the slice lifetime of Fields::Named. The is probably we need to consider during the API design.

@sunng87 sunng87 force-pushed the feature/valuable-json branch from 8d44650 to 2ccc2bf Compare July 19, 2021 15:37
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.

1 participant