Search code examples
rust

How to generate rustdoc for the Rust standard library in JSON?


I'm able to generate docs in JSON for my own library.

rustdoc -Z unstable-options --output-format json --out-dir=json_docs src/lib.rs

However no luck in finding a way to do so for the the whole Rust standard library. Is it possible?


Solution

  • In most cases you don't need to generate the docs, the JSON rustdoc for the standard library is available with the rust-docs-json rustup component:

    rustup component add --toolchain nightly rust-docs-json
    

    If you do need to generate them, clone the repo (--depth=1 is enough) and execute

    python x.py doc library -- --output-format=json