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

Debug and release builds

You may have noticed that the program was in a directory called target/debug. What's that about? By default, cargo builds our program in debug mode, which is what a programmer normally wants.

That means that the resulting program is instrumented to work with the rust-gdb debugging program so we can examine what is happening in its internals, and to provide useful information in crash dumps and such, as well as skipping the compiler's optimization phase. The optimizations are skipped because they rearrange things in such a way that it makes debugging information almost incomprehensible.

However, sometimes a program doesn't have any more bugs (that we know about) and we're ready to ship it out to others. To construct our final, optimized version of the program, we use cargo build --release.

This will construct the release version of the program, and leave it in target/release/foo. We can copy it from there and package it up for distribution.

主站蜘蛛池模板: 建始县| 阿巴嘎旗| 临海市| 忻州市| 金溪县| 滨州市| 永仁县| 定结县| 县级市| 出国| 隆回县| 山东省| 富锦市| 阿克苏市| 景洪市| 茂名市| 星子县| 东辽县| 白水县| 婺源县| 香格里拉县| 弥勒县| 留坝县| 辽宁省| 闵行区| 汕尾市| 陆良县| 准格尔旗| 昌吉市| 梅河口市| 安化县| 屏东市| 丹阳市| 莱芜市| 屯昌县| 洛隆县| 巨鹿县| 长治市| 姜堰市| 垫江县| 曲水县|