Tutorial by Examples

To ensure that all possible items are documented, you can use the missing_docs link to receive warnings/errors from the compiler. To receive warnings library-wide, place this attribute in your lib.rs file: #![warn(missing_docs)] You can also receive errors for missing documentation with this lin...
Rust provides two types of documentation comments: inner documentation comments and outer documentation comments. Examples of each are provided below. Inner Documentation Comments mod foo { //! Inner documentation comments go *inside* an item (e.g. a module or a //! struct). They use th...
/// In documentation comments, you may use **Markdown**. /// This includes `backticks` for code, *italics* and **bold**. /// You can add headers in your documentation, like this: /// # Notes /// `Foo` is unsuitable for snafucating. Use `Bar` instead. struct Foo { ... } /// It is cons...
Code in documentation comments will automatically be executed by cargo test. These are known as "documentation tests", and help to ensure that your examples work and will not mislead users of your crate. You can import relative from the crate root (as if there were a hidden extern crate ...

Page 1 of 1