module-concept
Rust Current-module visibility
Explicitly document the ordinary private access boundary. For typical module items pub(self) does not broaden access beyond the defining module and its descendants. Expected result (not executed): daily Why: Only report exposes show to its parent; label stays internal. Common mistake: Using pub(self) to try to expose a function externally.
Formal Syntax & Structure
rust syntaxrust
pub(self) fn helper() {}Working Example
Example Snippetrust
mod report { pub(self) fn label() -> &'static str { "daily" } pub fn show() { println!("{}", label()); }}fn main() { report::show(); }