diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-09-10 12:19:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-10 12:19:59 -0700 |
| commit | 91c3ef8bef7fcc48cae3cc73bf831465bbedd4dc (patch) | |
| tree | 14198f863e339ecf5721ad1de9a9f6b1ffafda96 /src | |
| parent | 5aed4957ff893823d353fe3f1d2e4a80ebe35007 (diff) | |
| parent | fd5859a673e69eb9fd98e9a92c32dd0dc7fc1855 (diff) | |
| download | rust-91c3ef8bef7fcc48cae3cc73bf831465bbedd4dc.tar.gz rust-91c3ef8bef7fcc48cae3cc73bf831465bbedd4dc.zip | |
Rollup merge of #76289 - arijit79:master, r=jyn514
Add docs about crate level documentation support Wrote information about how to write documentation on the crate level in rhe rustdoc book
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/rustdoc/src/what-is-rustdoc.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/what-is-rustdoc.md b/src/doc/rustdoc/src/what-is-rustdoc.md index adcebc832bc..7a38c96d714 100644 --- a/src/doc/rustdoc/src/what-is-rustdoc.md +++ b/src/doc/rustdoc/src/what-is-rustdoc.md @@ -93,6 +93,29 @@ passes `-L`, a flag that helps rustdoc find the dependencies your code relies on. If our project used dependencies, we'd get documentation for them as well! +## Outer and inner documentation + +The `///` syntax is used to document the item present after it. +That's why it is called an outer documentation. +There is another syntax: `//!`, which is used to document the +item it is present inside. It is called an inner documentation. +It is often used when documenting the entire crate, +because nothing comes before it: it is the root of the crate. +So in order to document an entire crate, you need to use `//!` syntax. +For example: + +``` rust +//! This is my first rust crate +``` + +When used in the crate root, it documents the item it is inside, +which is the crate itself. + +For more information about the `//!` syntax, see [the Book]. + +[the Book]: https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#commenting-contained-items + + ## Using standalone Markdown files `rustdoc` can also generate HTML from standalone Markdown files. Let's |
