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 Serialize and Deserialize implementations to Value #28

Open
ecton opened this issue Oct 31, 2024 · 0 comments
Open

Add Serialize and Deserialize implementations to Value #28

ecton opened this issue Oct 31, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ecton
Copy link
Member

ecton commented Oct 31, 2024

Right now Value can't be embedded in a type that derives serialize/deserialize because it doesn't implement those traits. There are two approaches: derive or try to do something special. The derive will clearly work, but when embedding within Rsn it might not render as cleanly as one might hope.

There are a few challenges when trying to do something special:

  • Value::Byte is indistinguishable from small unsigned integers stored in a Value::Integer
  • Value::Named uses a Map to store its struct contents. Maps allow any key type. Serde requires that struct field names are strings. We could add a new type for the struct contents that enforces the string key requirement to work around this.
@ecton ecton added the enhancement New feature or request label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant