-
-
Notifications
You must be signed in to change notification settings - Fork 114
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 support for ext_trait in properties macro #1149
Conversation
glib-macros/tests/properties.rs
Outdated
use super::*; | ||
|
||
#[derive(Properties, Default)] | ||
#[properties(wrapper_type = super::Author, ext_trait = AuthorExt)] |
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.
It seems strange to me that this trait is defined and implemented by this macro. Usually you want to have more things in the Ext
trait than just property setters/getters
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 think that is fine, as long as the trait is named something like AuthorPropertiesExt
, so you can also have a similar trait for auto generated signals in the future for example.
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.
And that could also be a super-trait of the actual Ext
trait. Maybe we should make that clearer in the docs?
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.
Now the trait defaults to MyTypePropertiesExt
. I didn't specify anything about a possible super-trait MyTypeExt
, because we don't have any macro to build that trait yet. The user can implement it as they wish.
closes #1059. Currently the user must always specify the name of the ext_trait.
Note: the ext trait is inevitably defined in the same
imp
module where#[derive(Properties)]
is called.Sadly this feature won't support adding other methods generated by a signal macro, because macros can't share data and the entire trait definition must happen in one macro.