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

book: Move from pub to pub(crate) #1484

Closed
wants to merge 1 commit into from

Conversation

Hofer-Julian
Copy link
Collaborator

It is arguably the correct way for this

It is arguably the correct way for this
@bilelmoussaoui
Copy link
Member

Using pub(crate) for a binary doesn't really make sense.

@@ -5,9 +5,9 @@ use gtk::{glib, CompositeTemplate, Label};
// Object holding the state
#[derive(CompositeTemplate, Default)]
#[template(resource = "/org/gtk_rs/example/window.ui")]
pub struct Window {
Copy link
Member

Choose a reason for hiding this comment

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

the imp struct could be pub(super) though

#[template_child]
pub label: TemplateChild<Label>,
pub(crate) label: TemplateChild<Label>,
Copy link
Member

@bilelmoussaoui bilelmoussaoui Sep 1, 2023

Choose a reason for hiding this comment

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

same, it should be pub(super)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I assume you mean pub(super)

Copy link
Member

Choose a reason for hiding this comment

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

yes, edited

@Hofer-Julian
Copy link
Collaborator Author

Using pub(crate) for a binary doesn't really make sense.

I thought so, too.
Turns out that also for binaries, cargo is not able to detect dead code if it's fully public.

@bilelmoussaoui
Copy link
Member

Using pub(crate) for a binary doesn't really make sense.

I thought so, too. Turns out that also for binaries, cargo is not able to detect dead code if it's fully public.

you can't really detect dead code for gtk apps, especially if you use composite template callbacks

@Hofer-Julian
Copy link
Collaborator Author

Using pub(crate) for a binary doesn't really make sense.

I thought so, too. Turns out that also for binaries, cargo is not able to detect dead code if it's fully public.

you can't really detect dead code for gtk apps, especially if you use composite template callbacks

Yeah, just noticed that too. Not sure if it's a macro thing, but static analysis totally fails there.
This makes this PR mostly useless.
Thanks for the comments @bilelmoussaoui!

@bilelmoussaoui
Copy link
Member

Yeah, just noticed that too. Not sure if it's a macro thing, but static analysis totally fails there.
This makes this PR mostly useless.

The macro actually uses the functions to create closures from them, but they can only be used at runtime. so nothing can be done at build time...

@bilelmoussaoui bilelmoussaoui deleted the Hofer-Julian/book-pub-crate branch September 1, 2023 13:10
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