Comments & Documentation

As can be seen throughout most code examples given in this chapter, Rust code can be annotated with comments that are ignored during compilation and execution.

Quick, single-line comments are denoted with a double forward slash (//):


    

If a more detailed description is required for a piece of code, Rust allows for doc comments, indicated with a triple forward slash (///):


    

Doc comments also support Markdown, allowing for division into titles, subtitles and code block examples if the documentation is being read in a text editor that supports Markdown: