module-concept

Rust Documentation visibility

Hide an item from ordinary generated documentation without changing Rust access control. This is useful for narrowly scoped infrastructure APIs, but is not a security or privacy boundary. Expected result (not executed): 8 Why: The public function remains callable even when documentation normally hides it. Common mistake: Using doc(hidden) instead of restricting visibility.

Formal Syntax & Structure

rust syntaxrust
#[doc(hidden)] pub fn helper() {}

Working Example

Example Snippetrust
mod api {    #[doc(hidden)]    pub fn helper() -> u32 { 8 }}fn main() { println!("{}", api::helper()); }
Rust Reference