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

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.
主站蜘蛛池模板: 辽宁省| 保康县| 北海市| 东源县| 北川| 沈阳市| 桂林市| 正定县| 万荣县| 南昌市| 额尔古纳市| 云阳县| 玉环县| 临清市| 界首市| 正蓝旗| 怀来县| 裕民县| 梁河县| 凭祥市| 田东县| 成武县| 龙井市| 吉林市| 本溪市| 石嘴山市| 寻甸| 华宁县| 朝阳区| 岳阳市| 慈溪市| 余庆县| 高邮市| 泾源县| 虎林市| 德庆县| 柏乡县| 韶山市| 西城区| 新绛县| 莱阳市|