Introduction
In this lab, we learn about the different types of comments supported by Rust, including regular comments and doc comments. Regular comments can be line comments, which start with two slashes and go to the end of the line, or block comments, which are enclosed between /*
and */
and can be nested. Doc comments, on the other hand, are used to generate HTML library documentation and start with ///
or //!
.
Note: If the lab does not specify a file name, you can use any file name you want. For example, you can use main.rs
, compile and run it with rustc main.rs && ./main
.
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
rust(("`Rust`")) -.-> rust/BasicConceptsGroup(["`Basic Concepts`"])
rust(("`Rust`")) -.-> rust/FunctionsandClosuresGroup(["`Functions and Closures`"])
rust(("`Rust`")) -.-> rust/MemorySafetyandManagementGroup(["`Memory Safety and Management`"])
rust(("`Rust`")) -.-> rust/ErrorHandlingandDebuggingGroup(["`Error Handling and Debugging`"])
rust/BasicConceptsGroup -.-> rust/variable_declarations("`Variable Declarations`")
rust/FunctionsandClosuresGroup -.-> rust/function_syntax("`Function Syntax`")
rust/FunctionsandClosuresGroup -.-> rust/expressions_statements("`Expressions and Statements`")
rust/MemorySafetyandManagementGroup -.-> rust/lifetime_specifiers("`Lifetime Specifiers`")
rust/ErrorHandlingandDebuggingGroup -.-> rust/error_propagation("`Error Propagation`")
subgraph Lab Skills
rust/variable_declarations -.-> lab-99185{{"`Rust Comment Types and Documentation`"}}
rust/function_syntax -.-> lab-99185{{"`Rust Comment Types and Documentation`"}}
rust/expressions_statements -.-> lab-99185{{"`Rust Comment Types and Documentation`"}}
rust/lifetime_specifiers -.-> lab-99185{{"`Rust Comment Types and Documentation`"}}
rust/error_propagation -.-> lab-99185{{"`Rust Comment Types and Documentation`"}}
end