-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
RFC: glib: Add optional support for serialization and deserialization with serde #1070
base: main
Are you sure you want to change the base?
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
@@ -59,6 +60,7 @@ log_macros = ["log"] | |||
dox = ["ffi/dox", "gobject_ffi/dox", "log_macros"] | |||
compiletests = [] | |||
gio = ["gio_ffi"] | |||
serialize = ["dep:serde"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why serialize
instead of serde
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I published a new version of trybuild2
with the commits of the upstream trybuild
.
3dd4e9c
to
297c255
Compare
9388fbf
to
407d50b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -23,7 +23,7 @@ jobs: | |||
- { name: "cairo", features: "png,pdf,svg,ps,use_glib,v1_18,freetype,script,xcb,xlib,win32-surface", nightly: "--features 'png,pdf,svg,ps,use_glib,v1_18,freetype,script,xcb,xlib,win32-surface'", test_sys: true } | |||
- { 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- { 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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me otherwise
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
serde
in theglib
package.Supported types for both deserialization and serialization:
glib::ByteArray
glib::Bytes
glib::GString
Some types are only serializable:
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 + ..>