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

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.

主站蜘蛛池模板: 丹东市| 兴文县| 三原县| 金堂县| 长春市| 佳木斯市| 浦北县| 宜良县| 祥云县| 天柱县| 巴彦县| 日喀则市| 巴南区| 达尔| 阜宁县| 双柏县| 白城市| 陈巴尔虎旗| 丹江口市| 北碚区| 桂东县| 司法| 东明县| 垣曲县| 滨海县| 台中县| 阿克苏市| 苏尼特右旗| 七台河市| 巴东县| 高要市| 资溪县| 子长县| 工布江达县| 旅游| 兰西县| 廊坊市| 达日县| 合肥市| 莱芜市| 西平县|