conferences | speakers | series

rustdoc: beyond documentation

home

rustdoc: beyond documentation
FOSDEM 2020

Rust compiler comes with a few tools, rustdoc is one of them. It is THE standard rust tool to generate documentation for your crates.

Rust compiler comes with a few tools, rustdoc is one of them. It is THE standard rust tool to generate documentation for your crates.

You can write documentation using "///" or "//!" patterns (which are syntaxic sugar over #[doc = "..."]).

It generates HTML which can used locally without a need for internet connection. The documentation search is running in JS directly in your browser. You have a source code viewer integrated. You can pick different themes (and even add one yourself). It works with javascript disabled. It provides settings to make your docs browsing more comfortable. You can generate docs with extra content (take a look at https://docs.rs/pwnies for a good example!).

But not only it generates documentation, it also adds things for each type that you didn't know was available thanks to the "Auto-traits implementation" and "Blanket implementation" sections.

In addition to generate documentation, it provides functionalities such as an integrated documentation's test runner (which themselves can be quite customized!). It also provides lints that can you deny (missingdocs, missingdoc_example).

With just all this, rustdoc is already a quite complete tool. But more will come in the future:

  • more interactive source code viewer
  • automatic link generation based on the item name
  • more output formats supported (json would be the first)
  • cfgs (doctest and doc)
  • doc aliases for search (for instance, "*" proposes pointer in the std lib)

Speakers: Guillaume Gomez