如何下载 Rust API 文档? [英] How can I download Rust API docs?

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

问题描述

有没有办法下载 Rust 的 API 库文档或生成它们?我能在 Rust 源代码中找到的唯一文档在 src/文档.

Is there a way I can download the API library docs for Rust or generate them? The only docs I can find in the Rust source are in src/docs.

我正在运行每晚构建,所以我确信有一种方法可以以与 标准文档 使用 rustdoc,我就是找不到!

I'm running the nightly build, so I'm sure there's a way to generate all the docs in the same fashion as the standard docs using rustdoc, I just can't find it!

我正在运行 Linux,使用每晚构建,使用以下命令:

I'm running Linux, with the nightly build, using this command:

curl -s https://static.rust-lang.org/rustup.sh | sudo sh

推荐答案

Rustup

如果您使用 rustup推荐安装和更新 Rust 的方式,那么文档可能已经安装;默认安装行为随着时间的推移而改变.尝试运行 rustup doc 在浏览器中打开它们.

If you use rustup, the recommended way to install and update Rust, then the docs may already be installed; the default installation behavior has changed over time. Try running rustup doc to open them in your browser.

如果尚未安装,您可以通过运行 rustup component add rust-docs 下载文档.

If they aren't already installed, you can download the docs by running rustup component add rust-docs.

默认情况下,rustup doc 打开文档首页,但您可以添加 --std 直接跳转到标准 API 文档或 --book 用于 Rust 编程语言.您还可以使用 rustup doc std::iter::Iterator 打开特定项目的文档.

By default, rustup doc opens the documentation front page, but you can add --std to jump straight to the standard API docs or --book for The Rust Programming Language. You can also use rustup doc std::iter::Iterator to open the documentation of a specific item.

rustup 1.20 学习了个人资料.这些允许您默认为工具链安装文档(通过 default 配置文件)或不安装(通过 minimal 配置文件).

rustup 1.20 learned the concept of profiles. These allow you to default to having docs installed for a toolchain (via the default profile) or not (via the minimal profile).

独立的 Rust 安装程序

Rust 安装程序还会安装该语言和 Cargo 的文档.在 Linux 系统上,它可以在 /usr/local/share/doc/{rust,cargo} 找到.

The Rust installer also installs the documentation for the language and for Cargo. On Linux systems, it can be found at /usr/local/share/doc/{rust,cargo}.

这篇关于如何下载 Rust API 文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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