-
Notifications
You must be signed in to change notification settings - Fork 227
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
Serde Behavior #629
Comments
On 1.: What this tries to achieve is to make On 2.: I'd like to solve this via explicit registration of |
@filmor When you have a chance, could you take a look at #639 and let me know if it seems like a good approach to fixing the first issue? It's mostly a cleanup of a change I made to my own serde_rustler fork, and I was originally just focusing on correcting the transcoding behavior, but I think this version should preserve the Once we have that sorted out, I'd love to hear if you have any thoughts on how the interface for the second issue (registering struct conversions) should look |
On the struct serde: I think registering using As a first step, Deserializer and Serializer need to be extended to keep and use a map |
This is a summary and continuation of benhaney/Jsonrs#26, by @filmor's request.
It was recently suggested to me that Jsonrs should switch to using Rustler's new Serde integration as its backend, which I'm very excited to do. But before I can, I need to make sure that Rustler's use of Serde can match what Jsonrs expects, so I don't break backwards compatibility. This issue represents the problems I've seen so far.
In approximate order of importance:
:ok
and:error
into the strings"Ok"
and"Err"
, inconsistent with the serialization of all other atoms. This is by far the biggest issue and should also be the easiest to fix.Decimal
struct at the Rust layer, so I will either need that same support in Rustler (sorry!) or a way to pass some custom struct encoding functions to the deserializer. I think the former would be a lot easier if it isn't too objectionable (and I'm happy to contribute the implementation I already have), but I recognize that it would be a bit weird for a general purpose NIF library like Rustler to specially handle struct encoding of specific Elixir packages, even if they're very popular.I think that's all I've found so far. Let me know your thoughts and what I can do to help with any of this!
The text was updated successfully, but these errors were encountered: