RFC: glib: Add optional support for serialization and deserialization with serde#1070
RFC: glib: Add optional support for serialization and deserialization with serde#1070rmnscnce wants to merge 1 commit intogtk-rs:mainfrom
Conversation
3479d6a to
6c67b19
Compare
|
I like this and we have something similar in place in the GStreamer bindings already. You probably want to mention this new feature in the README.md though. Also do you see a possibility of moving all that repetitive code into a macro or two? :) |
|
Looks like a good idea. |
5e2d762 to
d95e941
Compare
glib/Cargo.toml
Outdated
| dox = ["ffi/dox", "gobject_ffi/dox", "log_macros"] | ||
| compiletests = [] | ||
| gio = ["gio_ffi"] | ||
| serialize = ["dep:serde"] |
There was a problem hiding this comment.
I wanted to use serde but seems like the tests break on it.
https://github.com/gtk-rs/gtk-rs-core/actions/runs/4616156154/jobs/8160815190#step:19:414
https://github.com/gtk-rs/gtk-rs-core/tree/5e2d7622885fd64cfbf7a727273d78368cdc139e
There was a problem hiding this comment.
Hrm that looks like a bug in trybuild2. @GuillaumeGomez you're maintaining that, can you take a look? :)
There was a problem hiding this comment.
I published a new version of trybuild2 with the commits of the upstream trybuild.
3dd4e9c to
297c255
Compare
9388fbf to
407d50b
Compare
sdroege
left a comment
There was a problem hiding this comment.
Can you also add something to the CI so that it builds with and without the serde feature so we can make sure things continue to work?
d222857 to
59b15e0
Compare
c45eb0b to
abe5dfd
Compare
89d0f10 to
e4e7b7f
Compare
.github/workflows/CI.yml
Outdated
| - { name: "gdk-pixbuf", features: "v2_42", nightly: "--all-features", test_sys: true } | ||
| - { name: "gio", features: "v2_74", nightly: "--all-features", test_sys: true } | ||
| - { name: "glib", features: "v2_74", nightly: "--all-features", test_sys: true } | ||
| - { name: "glib", features: "v2_74,serde", nightly: "--all-features", test_sys: true } |
There was a problem hiding this comment.
| - { name: "glib", features: "v2_74,serde", nightly: "--all-features", test_sys: true } | |
| - { name: "glib", features: "v2_74", nightly: "--all-features", test_sys: true } | |
| - { name: "glib serde", features: "v2_74,serde", nightly: "--all-features", test_sys: true } |
or so maybe so we test both configurations?
ea985eb to
5fd8889
Compare
… serde This feature is gated as `serde` Supports both serialization and deserialization: - glib::ByteArray - glib::Bytes - glib::GString Supports serialization only: - glib::GStr - glib::StrV Collection types are also supported as long as the type parameters implement the necessary traits: - glib::Slice<T: TransparentType + ..> - glib::PtrSlice<T: TransparentPtrType + ..> - glib::List<T: TransparentPtrType + ..> - glib::SList<T: TransparentPtrType + ..>
If merged, some GLib types will gain serialization and deserialization support through the serde serialization framework. This feature is gated as
serdein theglibpackage.Supported types for both deserialization and serialization:
glib::ByteArrayglib::Bytesglib::GStringSome types are only serializable:
glib::GStrglib::StrVCollection types are also supported as long as the type parameters implement the necessary traits:
glib::Slice<T: TransparentType + ..>glib::PtrSlice<T: TransparentPtrType + ..>glib::List<T: TransparentPtrType + ..>glib::SList<T: TransparentPtrType + ..>