官术网_书友最值得收藏!

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.
主站蜘蛛池模板: 民和| 永兴县| 南江县| 藁城市| 都昌县| 秭归县| 文登市| 尼勒克县| 甘谷县| 讷河市| 抚州市| 隆德县| 华坪县| 临汾市| 中江县| 红安县| 宁国市| 泽州县| 从化市| 闻喜县| 岳阳市| 和田市| 三门峡市| 资源县| 定襄县| 浏阳市| 永州市| 慈溪市| 太仆寺旗| 茌平县| 望江县| 青州市| 新源县| 同心县| 河北区| 临西县| 上高县| 龙胜| 晋城| 浦北县| 小金县|