Guidelines for method visibility of pub(crate) types

Hi!

Suppose I have a pub(crate) struct Foo. How should I mark public methods on this struct? pub fn bar(&self) or pub(crate) fn bar(&self). The letter one seems more correct, but it also looks superfluous, because the struct itself is only pub(crate)...

1 Like

I'd probably go for the first version. Besides being less typing, I'd say it's more semantically correct because your bar() method is part of the type's public interface.

1 Like