Skip to main content

Mojo function

doc_private

doc_private()

Indicate that the decorated declaration is private from the viewpoint of documentation generation.

This decorator allows for hiding the documentation for a declaration during generation. This is often used to hide __init__, and other special methods, that are not intended to be part of a library's documentation.

For example:

struct Foo:
@doc_private
fn __init__(out self):
"This should not be called directly, use `Foo.create` instead."
return

@staticmethod
fn create() -> Self:
return Self()
struct Foo:
@doc_private
fn __init__(out self):
"This should not be called directly, use `Foo.create` instead."
return

@staticmethod
fn create() -> Self:
return Self()

Was this page helpful?