Loading tutorials
pub. It also assumes you can build a library crate with Cargo and that you know basic Markdown. Doc tests come in a later chapter, so this one only covers the comment syntax.2 min read/// comments, build a library crate with Cargo, and read basic Markdown. Here you will see which Markdown rustdoc supports, how the first paragraph is used, and the mistakes that most often break rendered output.2 min read/// comments, know basic Markdown, and can run cargo test --doc. It covers four section headings that Rust libraries use by convention. rustdoc does not treat them specially. They are Markdown headings that readers and Clippy lints expect to find.2 min read/// comments on functions and run cargo test --doc. You should also know how mod declarations and pub visibility work. Here you will document the containers that hold your items: the crate and its modules.2 min read/// and //! comments, format them with Markdown, and run cargo doc. Here you will link from one piece of documentation to another item, such as a function, type, or module. Rustdoc checks these links when it builds the docs.2 min read/// comments on public items. You will build the HTML documentation for your crate, open it in a browser, and learn which flags change what gets built.3 min read/// comments and Markdown, and write tests with assert_eq!.2 min read/// comments and run cargo test --doc. It also assumes you know what the ? operator does.2 min read/// comments with fenced examples and run cargo test --doc. Every example in a doc comment is a test by default. It is compiled and run, and it must finish without panicking. Some examples can't meet that rule, so you can add attributes to the opening fence to 2 min read/// comments with fenced examples and run cargo test --doc. Here you will learn what happens between that command and the pass or fail result. Knowing this explains most surprising doc test failures.3 min read/// comments, run cargo test --doc, and hide lines with # . You should also know how ? and Result work in ordinary Rust code.2 min read/// and //! comments, run cargo doc, and know what pub use does. The #[doc] attribute gives you control over how rustdoc presents items, beyond what the comment text alone can do.2 min read/// and //! comments, use intra-doc links, and run cargo doc and cargo test --doc. Here you will make the compiler and rustdoc report missing or broken documentation, so gaps are caught by tooling and not by reviewers.2 min readmissing_docs and rustdoc lints. Here you will run those checks automatically and see how your docs appear on docs.rs.2 min read