如何在Cargo.toml中强制启用--document-private-items生成私有项文档?
在Cargo.toml中强制配置生成私有项文档的方法
当然可以,有两种常用配置方式,分别对应本地构建和docs.rs平台构建:
本地构建自动生效:在Cargo.toml中添加
[profile.doc]配置块,指定rustdoc-flags参数:[profile.doc] rustdoc-flags = ["--document-private-items"]之后运行
cargo doc时,就会自动启用私有项文档生成,无需手动追加命令行参数。针对docs.rs平台配置:如果需要让docs.rs上生成的文档也包含私有项,添加
[package.metadata.docs.rs]配置块:[package.metadata.docs.rs] rustdoc-args = ["--document-private-items"]这样docs.rs在构建你的 crate 文档时,会自动应用该参数。
内容的提问来源于stack exchange,提问作者Netwave
相关产品推荐
相关产品推荐

