Guidelines for method visibility of pub(crate) types


#1

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)


#2

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.