This post is written by YoungJ-Baek

1. Preface

Almost every open source code has their own documentation for easier usage. Furthermore, if it is very famous library, there must be some tutorial code and documentation. However, it is very inconvenient to google every functions and usages for all the moments. So, cargo provides project level documentation referring your code.

2. Cargo Doc

2.1. Open the Documentation

First, open your terminal in your project folder, and then type the command below. It will open project level documentation, and for this post, I will use guessing game as an example.

Command

$ cargo doc --open

2.2. Documentation Demonstration

Now, you can see the website containing all the information of your project. Figure below shows the demonstration of opening documentation.

In the documentation, you can find which traits to use and which methods and functions to call from a crate. In this case, you can find more details about rand crate in the sidebar on the left. Figure below shows the tutorial documentation of rand.

Leave a comment