Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate documentation for private items

I have a project with:

main.rs
module_1/mod.rs
module_2/mod.rs
module_2/module_3/mod.rs

when I run cargo doc, I have just documentation for main.rs, not for modules.

In my main.rs I have:

mod module_1;
mod module_2;

fn main() {
...
}

I have tried documenting modules using /// or //!.

I can't find in rustdoc's help how do that.

Somebody can explain me?

like image 586
bubulemaster Avatar asked Sep 02 '18 10:09

bubulemaster


People also ask

How do you create a process documentation guide?

Create a process documentation guide, which anyone can refer to as a standard template for documenting a process. Make use of existing documentary material, records, interviews, case studies, field-diaries of project staff and the knowledge of employees to gather information for process documentation.

How do I publish a private package on npm?

Note: Before you can publish private user-scoped npm packages, you must sign up for a paid npm user account. Additionally, to publish private organization-scoped packages, you must create an npm user account, then create a paid npm organization. Creating a private package

How to create a Javadoc document?

To create a JavaDoc you do not need to compile the Java file. We can generate JavaDoc documentation in two ways. The command-line tool allows us to run the command through it. This command can be executed on a command line and has the following syntax. In the above command, we assume that all the files and Java classes are in the src folder.

Why developers don’t like creating documentation?

Creating documentation is not a “pleasant” activity for the developers (compared to creating code) — some developers don’t like to create the documentation, they will be demotivated when asked to do it. Cons of bad documentation? “Out-of-date” documentation can lead to misunderstandings and slower development 2.


1 Answers

This is because those modules are private, and the default behavior is to document public members only.

As of Rust 1.29.0, cargo doc supports --document-private-items, to document private items.

Before 1.29, rustdoc already supported the flag --document-private-items, which means you could generate documentation for your project using cargo rustdoc -- --document-private-items, but cargo doc did not support the flag.

like image 55
mcarton Avatar answered Oct 22 '22 00:10

mcarton