如何生成私人物品的文档 [英] How to generate documentation for private items

查看:84
本文介绍了如何生成私人物品的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,其中:

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

当我运行cargo doc时,我只有main.rs的文档,而不是模块的文档.

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

在我的main.rs中,我有:

mod module_1;
mod module_2;

fn main() {
...
}

我尝试使用/////!记录模块.

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

我在rustdoc的帮助中找不到该怎么做的.

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

有人可以解释我吗?

推荐答案

这是因为这些模块是私有的,默认行为是仅记录公共成员.

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

截至 Rust 1.29.0 cargo doc支持--document-private-items来记录私人物品.

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

在1.29之前,rustdoc已经支持标志--document-private-items,这意味着您可以使用cargo rustdoc -- --document-private-items为项目生成文档,但是cargo doc不支持该标志.

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.

这篇关于如何生成私人物品的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆