How to check standard library documentation offline?

1.5k views Asked by At

I found rustdoc command and I kind of expected it to work like pydoc. Unfortunately, rustdoc std::io:stdin doesn't do what I'd like it to. Is there a way to view standard library documentation in an offline form, either via command line or some kind of built in web server, like Python's pydoc allows?

2

There are 2 answers

1
mcarton On

rustdoc is used to build the documentation of a package. Not to access standard doc.

If you use rustup, you can open the offline documentation using rustup doc --std and then use the search box on the page (works offline too). If you don't use rustup, the documentation might still have been installed somewhere on your system but the path would depend on the system and installation procedure.

0
Lukas Kalbertodt On

You can generate the offline documentation by cloning the Rust Compiler Repository and run rustdoc inside. This is rather complicated, though. Luckily, there are other ways!

Rustup, the tool that just hit 1.0 and is now the preferred installation method for Rust, already downloads the docs for you! If you are using it, you can find the docs in ~/.multirust/toolchains/*/doc where * is your toolchain-name. For example:

~/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/std/

Apart from that, there are many tools like "Zeal" which provide offline documentation for multiple languages.