gpt4 book ai didi

rust - 如何防止 `rust doc` 向文档添加依赖项?

转载 作者:行者123 更新时间:2023-11-29 07:41:37 25 4
gpt4 key购买 nike

我刚刚开始使用 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

我希望对用户隐藏这些依赖项的文档,因此我的文档仅显示如何使用我的代码。

我该怎么做?

cargo 锁

[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 - 如何防止 `rust doc` 向文档添加依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34215411/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com