Additional Functionality with Cargo
Learn how to create docs and libraries with Cargo for others to view and use.
As we know it is extremely important to document one's code so that other developers can easily understand it. It is also a good practice when sharing code to properly document it so that others can easily contribute to it. In Rust, there are two ways we can create our code's documentation.
Using comments in Rust
Similar to other programming languages, Rust supports two types of comments: single-line comments and multiline comments
Let's talk first about how we can add single-line comments. We can them using two consecutive forward slashes (//
).
Get hands-on with 1400+ tech skills courses.