Skip to content
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

codgen: generate doc_alias for static_type #1143

Merged
merged 1 commit into from
Aug 25, 2023
Merged

codgen: generate doc_alias for static_type #1143

merged 1 commit into from
Aug 25, 2023

Conversation

bilelmoussaoui
Copy link
Member

this allows finding *_type() functions using their c names

See gtk-rs/gtk4-rs#383 for the end result

Copy link
Member

@sdroege sdroege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That of course only helps for enums/flags and not for boxed/shared/object types :) Not sure how useful that is overall.

@bilelmoussaoui
Copy link
Member Author

That of course only helps for enums/flags and not for boxed/shared/object types :) Not sure how useful that is overall.

For boxed/shared/object types, we need a way for glib::wrapper! to add the doc aliases which is not possible as far as I can tell, you can't stringify something and pass it to #[doc(alias = "x")] if type_ is passed

I don't think it's super useful, but it would reduce the questions of how can I get get_type() for this type. Especially if people are copying a C example/looking at the C docs

@bilelmoussaoui
Copy link
Member Author

So I suppose this is something we should just close?

@sdroege
Copy link
Member

sdroege commented Dec 9, 2022

Do doc aliases on trait impls actually work? I thought they only work on trait definitions

@bilelmoussaoui
Copy link
Member Author

Do doc aliases on trait impls actually work? I thought they only work on trait definitions

They do, see https://gtk-rs.org/gtk4-rs/stable/latest/docs/?search=gtk_widget_get_css_name and I still think we should land this one btw. The fact we can't get a doc alias for types using glib::wrapper! is something that might get fixed in the future but shouldn't block what we can improve already.

@sdroege
Copy link
Member

sdroege commented Dec 9, 2022

Sure, why not. Doesn't seem too useful for only enums/flags but it's something :)

this allows finding *_type() functions using their c names
@bilelmoussaoui bilelmoussaoui merged commit 24902d9 into gtk-rs:master Aug 25, 2023
@bilelmoussaoui bilelmoussaoui deleted the bilelmoussaoui/gen-doc-alias-static-type branch August 25, 2023 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants