When imlementing non-private methods for a pub(crate)/pub(super) struct should they also be pub(crate)/pub(super) or just pub?
if I have some struct
pub(crate) struct Foo { ... } I can write
impl Foo { pub(crate) fn bar(&self) { ... } } But I could also safe a few letters and write
impl Foo { pub fn bar(&self) { ... } } and it'd be roughly equivalent as the ""public"" method can only accessed if you have the struct, which is pub(crate).
3 posts - 3 participants