-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
SerializeDict and friends make instances not usable for other data formats #176
Comments
In GitLab by @jhartzell42 on Jul 15, 2021, 22:53 @elmarco I was told by Zeeshan Ali that you are one person to ask about this. I think it can be made easy on the client program if we redefine SerializeDict etc. to implement Serialize. TypeDict would simply stay there and derive the dict version of the Type trait rather than the typed version. I think this would be very source compatible for the client program. |
@jhartzell42 I'll look into this more in detail in a week when I'm back from vacation but I wanted to ask if you've looked at |
In GitLab by @jhartzell42 on Jul 16, 2021, 17:47 Are you asking if I'm sure we need the additional method on the |
No, I mean the extra zbus information that gets sent from Serialize impl to the serializer. That's why I wrote:
My main thought here is that first we should ensure that there is no way to make things work without changing or adding any API before thinking of more intrusive solutions. |
In GitLab by @jhartzell42 on Jul 16, 2021, 23:32 Could you please explain what “extra zbus information” you’re referring to? I think it can be done without additional APIs, because the Type trait already exists and a type would have a different DBus signature for the Dict vs not Dict situation. |
In GitLab by @jhartzell42 on Jul 16, 2021, 23:33 Or do you mean you want to transition away from the Type trait altogether? |
I mean the
I guess there was a typo here: "can" -> "can't"? Additional API is fine but changing the fundamental API would require a very compelling reasoning and to only be considered after exhausting other possibilities.
The unwanted "tags" are not related to
Not sure I understood this one. By |
In GitLab by @jhartzell42 on Jul 22, 2021, 22:44 Let me take a look at the code and get back to you; I think I'm confused about how this works :upside_down: |
In GitLab by @jhartzell42 on Jul 26, 2021, 21:36 So here's what I was thinking:
https://gitlab.freedesktop.org/dbus/zbus/-/blob/main/zvariant/src/deserialize_value.rs#L41 ... but couldn't figure out a way not to leak memory. This means that you can't use this inside a SerializeDict or a variant. But given that it offers a replacement to SerializeDict, that's not perhaps as big a problem. And I'm confident I can figure out that last issue. And this is enough that you get the general idea of where I'm headed. What are your thoughts? |
In GitLab by @jhartzell42 on Jul 26, 2021, 21:42 Here's the gitlab PR: https://gitlab.freedesktop.org/dbus/zbus/-/merge_requests/342 , sorry about that :-) |
Don't see this going anywhere, at least any time soon. |
This is no longer needed. While this doesn't completely fix dbus2#176, this goes as far as we can IMO. For D-Bus we need the signature to be able to derialize any data to a Value.
In GitLab by @jhartzell42 on Jul 15, 2021, 22:40
I am interested in fixing this myself, but would like to discuss first.
When I use
DeserializeDict
, and then use the Deserialize instance for e.g. JSON, due to the implementation of DeserializeDict I get JSON full of references to zbus:I have a proposal that will address this and simultaneously allow dict-style users of zbus to use all serde macros. The proposal is to have the zbus serializer/deserializer switch whether they work in "dict" mode or "typed" mode based on a new method to be added to the type trait,
Alternatively, a separate serializer (to Value objects potentially rather than directly to the binary type) could be used.
This would allow the serde instances to all be cross-format and also get support for all the attributes for free.
I think this would be EASIER than adding all the attributes to the *Dict forms of the macros (especially since I'd like to make the change and this would be better for my purposes :-) )
The text was updated successfully, but these errors were encountered: