-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add some quality-of-life gdbus helpers #1558
Conversation
a490113
to
4c7e15f
Compare
4c7e15f
to
7ebb847
Compare
7ebb847
to
53076df
Compare
c17799f
to
8dc90c6
Compare
Accidentally committed some left over change, I'll fix this tomorrow. |
8dc90c6
to
ee24ad8
Compare
4d89fbe
to
149f77c
Compare
@sdroege Pipeline passes now, but the question about the name still stands... should I rename the method? |
This trait represents a parsed method call with deserialized arguments, to abstract over call parsing. Then add new registration builder helpers to register method calls with a simplified callback which receives parsed arguments, and can optionally return an async result.
8c9d142
to
7bb83b2
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.
Thank you for reviewing and merging 🙏 |
glib::timeout_future(Duration::from_secs(delay as u64)).await; | ||
let greet = format!("Hello {name} after {delay} seconds!"); | ||
println!("{greet}"); | ||
Ok(Some(greet.to_variant())) |
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.
We should probably also figure out a way to make the return value more type safe
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.
Type safety as in "the return value matches the signature of the Dbus interface"?
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.
Yes. Maybe the structs in the enum need to implement a trait with an associated type for that, or so. I think that would all require a bit of reorganization though
Add a helper to return a standard result type from an invocation, automatically wrapping the return value into a tuple if it isn't a tuple yet.
Add another helper to return an async result from a future.
Update the gdbus example to demo the new async helper, and show how to simplify parameter handling with auto-derived variant structs.