- Mastering Rust
- Rahul Sharma Vesa Kaihlavirta
- 143字
- 2021-07-02 13:35:26
Generating and viewing documentation
To generate documentation, we can use the cargo doc command in our project directory. It generates docs in the target/doc/ directory with a bunch of HTML files and predefined stylesheets. By default, it generates docs for a crate's dependencies too. We can tell Cargo to ignore generating docs for dependencies by running cargo doc --no-deps.
To view the documentation, one can spawn a HTTP server by navigating inside the target/doc directory. Python's simple HTTP server can come in handy here. However, there's a better way to do this! Passing the --open option to cargo doc will open the documentation page directly in your default browser.
cargo doc can be combined with cargo watch to get a seamless experience in writing documentation and getting live feedback on the generated page for any documentation changes you do on your project.
推薦閱讀
- Hyper-V 2016 Best Practices
- Visual Basic程序開發(學習筆記)
- Oracle從新手到高手
- MATLAB圖像處理超級學習手冊
- PHP+MySQL網站開發技術項目式教程(第2版)
- Java程序設計與實踐教程(第2版)
- QGIS By Example
- 從零開始學Linux編程
- Learning Modular Java Programming
- 從Power BI到Analysis Services:企業級數據分析實戰
- Penetration Testing with the Bash shell
- Mastering Apache Camel
- 高效使用Greenplum:入門、進階與數據中臺
- 交互設計師成長手冊:從零開始學交互
- 零基礎學Java(第5版)