-
Notifications
You must be signed in to change notification settings - Fork 82
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
delegate macros as attributes #424
Comments
While this would be nice, currently the |
You mean using supertraits for delegate macros bound? I didn't find any relative example, perhaps you have any related code to share? |
https://github.com/Smithay/client-toolkit/blob/master/examples/data_device.rs has an example of what I mean. |
Oh, I see what you mean. Perhaps this could be solved with an additional trait specifically for delegation? E.g given the following defintions: trait PrimarySelection {
fn selection(..);
fn send_request(..);
fn cancelled(..);
}
impl<T: PrimarySelection> PrimarySelectionDeviceHandler for T {
fn selection(self, args) { PrimarySelection::selection(self, args) }
}
impl<T: PrimarySelection> PrimarySelectionSourceHandler for T {
fn send_request(self, args) { PrimarySelection::send_request(self, args) }
fn cancelled(self, args) { PrimarySelection::cancelled(self, args) }
} Then in user code impl only #[sctk::delegate]
impl PrimarySelection for MySelection {
...
} I'm not sure yet about this being breaking change though. That might be a problem |
For now for implementing a certain feature, one need to implement trait, then call a
delegate_<feat>!
on the structure which seems a little bit redundant, so instead of this:it would be nice to have this instead:
The text was updated successfully, but these errors were encountered: