我刚刚开始玩Rust,并试图为我编写的代码生成文档.当我发行cargo doc美元时,我看到了一些奇怪的东西.

21:53 $ cargo doc
   Compiling regex-syntax v0.2.2
   Compiling libc v0.2.2
   Compiling memchr v0.1.7
   Compiling aho-corasick v0.3.4
   Compiling regex v0.1.41
   Compiling my_project v0.0.1 (path/to/my_project)

当我打开my_project/target/doc/my_project/index.html时,我注意到所有依赖项都包含在我的文档中:

Those damn crates

我希望这些依赖项的文档对用户隐藏,这样我的文档只显示如何使用my个代码.

我该怎么做?

Cargo.lock

[root]
name = "my_project"
version = "0.0.1"
dependencies = [
 "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "aho-corasick"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "memchr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "libc"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "memchr"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "regex"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "aho-corasick 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "memchr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "regex-syntax 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "regex-syntax"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

推荐答案

我找到了答案:cargo doc --no-deps.

Rust相关问答推荐

为什么迭代器上的`. map(...)`的返回类型如此复杂?

如何使用字符串迭代器执行查找?

为什么reqwest以文本形式下载二进制文件?

如何格式化传入Rust中mysql crate的Pool::new的字符串

如何点击()迭代器?

S在Cargo.toml中添加工作空间开发依赖关系的正确方法是什么?

在我的Cargo 中,当我在建筑物中使用时,找不到我可以在产品包中使用的 crate .r我如何解决这个问题?

为什么Rust不支持带关联常量的特征对象?

不能在Rust中使用OpenGL绘制三角形

我如何使用AWS SDK for Rust获取我承担的角色的凭据?

具有多个键的 HashMap

Rust 1.70 中未找到 Trait 实现

Rust 异步循环函数阻塞了其他future 任务的执行

如何连接 Rust 中的相邻切片

Rust 将特性传递给依赖项

如何在 Rust Polars 中可靠地连接 LazyFrames

使用方法、关联函数和自由函数在 Rust 中初始化函数指针之间的区别

Rustlings 切片原语

在 Rust 中枚举字符串的最佳方式? (字符()与 as_bytes())

如何制作具有关联类型的特征的类型擦除版本?