-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
codegen: only generate trait signatures once #1461
Conversation
I don't know why it is done this way. It was like that when I first looked at gtk-rs :) @GuillaumeGomez ? |
I don't remember at all. It looks like a failed rebase. If it doesn't change anything, then it's a great improvement! |
What do you mean with failed rebase? Also when regenerating, this will require changes to all the manual traits too. |
Then I clearly misunderstood what it was doing. Oh well. |
It removes the ext trait function implementations and moves them into the trait definition as default implementations for the functions. So the ext trait implementation is now only a single line, and the signatures for the functions have to provided only a single time. The main difference here is that if it's possible to also implement the trait on other types then they would automatically get the default implementations of the functions now instead of having to provide some. The default implementations would likely be wrong for any other implementation. But can there be other implementations of those traits or would all possible implementations overlap with the blanket implementation? |
So the |
It would work for |
I think it makes sense to say we don't want anybody implementing |
Is there some reason this is not done already? It seems to reduce code size in gtk4-rs by about 5-6%.