-
-
Notifications
You must be signed in to change notification settings - Fork 175
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 interface bounds to Impls #1883
Conversation
PrintOperationPreviewImpl + ObjectSubclass<Type: IsA<PrintOperation>> | ||
ObjectImpl + ObjectSubclass<Type: IsA<PrintOperation> + IsA<PrintOperationPreview>> |
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.
For consistency with other implementations. This derives from glib::Object
, but implements gtk::PrintOperationPreview
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.
Does a print operation necessarily requires a print operation preview?
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 https://docs.gtk.org/gtk4/class.PrintOperation.html
It is surprising to me as well that it's set up that way, but it is how it is.
class Gtk.PrintOperation : GObject.Object
implements Gtk.PrintOperationPreview {
/* No available fields */
}
8d2bf10
to
f47c400
Compare
forgot doc tests, they should hopefully pass now |
f47c400
to
2dc5b48
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.
otherwise lgtm
74a9395
to
78011d6
Compare
Almost there! |
328464d
to
918adf9
Compare
918adf9
to
e1d3005
Compare
CI driven development! 🙄 I could have spent this time to make a toolbox with gtk nightly so that I can use |
Actually, you don't even need that. There is a trick, to build by passing the same rustc flags we pass for the docs. It won't try to link against gtk ;) I forgot the details though, can find that again if you ever need it |
What this does
@implements
directive for all interfaces that are implemented by the object, even interfaces implemented by the parent. (positive check)What this doesn't do
wrapper
macro and nothing checks this. This is a hard problem, and if at all only solveable at runtime. (not sure how, but it could be possible by doing some assertions on type_init maybe, needs more research)#[diagnostic::on_unimplemented]
for the IsA trait (it is stable since 1.78).See also gtk-rs/gtk-rs-core#1551