A guide on how to write documentation in Rust. By Guillaume Gomez.
Don’t write documentation for others but for yourself!
Before explaining how to write nice documentation and everything, we need to cover the basics on how to actually write documentation with Rust. First thing to note, you can generate it using rustdoc.
The article then dives straight into:
- Basics
- Doc comments
- Documenting a crate
- Writing a good documentation block
- Code examples
- More control over code examples testing
- Hiding lines
- Using rustdoc lints
Always document all public items. Always have at least one code example in every documentation block. Better small than nothing. Good read!
[Read More]