-
-
Notifications
You must be signed in to change notification settings - Fork 62
Add GVariant bindings for non-basic types, nested types: arrays, tuples, dicts, ... #113
Comments
While general GVariant support is there since a while, what is missing is support for non-basic, nested types: arrays, tuples, dicts, etc. |
I've been working on a pure rust implementation of The design is a little different to GLib's in that the type signatures must be known at compile time. The behaviour of the crate matches GLib's, at least for all data in "normal form". I'm preparing to release version 1.0: ostreedev/gvariant-rs#1 but before I do I'd like to get some feedback. Specifically: @sdroege: could you comment on what it would take for the glib-rs docs to recommend using the gvariant crate instead of the bindings to the GLib GVariant implementation? If the answer is "not going to happen" that's fine too, I'll just stop worrying about it. |
@wmanley There's also zvariant, which unlike yours also provides serialization support and has serde integration. We could probably list native Rust alternatives in the docs (also zbus instead of GDbus once bindings for that are there), do you want to prepare a PR for that? We should still provide proper GVariant bindings here, independent of all that. |
Note: ZVariant is an implementation of the DBus wire format, not GVariant. The docs say "GVariant is also very common and will be supported by a future version of this crate.". I discuss other implementations in the docs of the gvariant crate: https://docs.rs/gvariant/0.2.0/gvariant/#comparison-to-and-relationship-with-other-projects
Will do. |
@wmanley I'm working on GVariant support in zvariant this week. I'm hopeful that it can be done w/o breaking any API. If you'd like to help in this regard, you can add the missing GVariant bindings here so I can use them in my tests. |
Yeah but GVariant support is very much planned from beginning and hence the reason zvariant is separate from zbus crate. Nobody uses D-Bus format for anything other than D-Bus AFAIK so w/o GVariant support, zvariant as a crate is not very useful. |
To test my implementation I used |
Thanks. I'll have a look. :)
Hmm.. I could also do the same but it would be best if glib-rs gains the missing GVariant API as a side-effect of this effort. |
This may also be of interest: https://gitlab.gnome.org/GNOME/glib/-/issues/2121 |
@wmanley Looking into container types now, array being the first one. I'm a bit unclear about how to find the framing offset size. Do I understand correctly from your code that:
|
Yes. This makes reading easy, but complicates writing.
Correct |
@wmanley many thanks! |
Hi! Is there any way to read/write gsettings arrays in Rust? I am playing with the idea of porting PulseEffects to Rust but we have gsettings keys stored as arrays. For example
I was able to read it with this ugly code:
But I do not see how I could write this array to the gsettings database. |
#651 fixed this I believe. |
We don't have 'em yet.
The text was updated successfully, but these errors were encountered: