-
-
Notifications
You must be signed in to change notification settings - Fork 90
Replace manual enum functions with autogenerated ones #155
Conversation
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.
Looks generally good to me, thanks!
db12b37
to
47767ad
Compare
@sdroege Pushed! Turns out I have more |
I don't think that assumption is necessarily correct :) But better put those into a separate PR, not as part of this one. That's an easy to review change. |
@sdroege Hence the question mark, I'm curious yet have never looked into the resulting assembly from all these formatting macros. I assumed it to be pretty efficient but that might have been massively wrong :) |
Well, IMHO it's also nicer to read code-wise so definitely a useful change even if it compiles to the same code. It actually might as the format string is handled at compile-time. |
Finally got around to writing the three variants in godbolt: https://godbolt.org/z/v3xoxK Note that this is might be hard to relate as
Next is writing a literal with Finally there is |
Ok, so as expected I guess? :) |
@sdroege Yup. It's not all too suboptimal. The function pointer |
13b4b9f
to
77deb68
Compare
83b9b62
to
da657db
Compare
da657db
to
92678ce
Compare
Otherwise looks good |
9893478
to
9290db0
Compare
9290db0
to
ae286e3
Compare
@MarijnS95 Your latest gir changes don't affect this one here? Otherwise please also update it :) |
@sdroege Nope, all clear here :) |
@MarijnS95 Please update this one with the latest gir, and then let's get it in :) |
Semantics in gir recently changed to still generate trait implementations for manual functions; only the function itself is expected to be implemented by hand.
Because generate_display_trait is true.
This is said to be a problematic binding that needs a manual implementation.
Most regeneration changes are separated out per feature in previous commits: - Associated functions on enums/flags; - Display for get_name(); - Add missing #[cfgs]; - Manually implement some functions.
ae286e3
to
5b66ba5
Compare
@sdroege Thanks again! Updated with the latest hashes :) |
gtk: generate ApplicationBuilder manually
This is the gtk-rs counterpart of https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/630, following the introduction of autogenerated associated function support in gtk-rs/gir#991.
Turns out that, as far as I was able to run the tests (after extracting them from
CI.yml
...), the only functions that were defined by hand are in pango'sGravity
enum 🎉(testing with
--all-features
doesn't work because that inadvertently removes functions throughcfg(not())
which are used by examples)Note that this includes gtk-rs/gir#994 to get rid of
doc(cfg())
on match arms and expressions. Solves a ton of warnings (When compiling withdox
) but at the same convolutes this PR. See the second commit for an actually relevant change.Let's hold off merging until
gir
is ready.