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

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.
主站蜘蛛池模板: 焦作市| 旌德县| 连城县| 鄱阳县| 精河县| 碌曲县| 化德县| 延吉市| 阳东县| 沙田区| 诸城市| 西安市| 皮山县| 集贤县| 福建省| 神池县| 偏关县| 娱乐| 吴江市| 永顺县| 嵩明县| 赤水市| 双城市| 洛扎县| 乌苏市| 淮滨县| 连平县| 五大连池市| 湛江市| 长泰县| 饶河县| 古浪县| 洞头县| 南木林县| 义马市| 克什克腾旗| 且末县| 寿阳县| 紫金县| 和硕县| 德惠市|