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

Cleaning your source tree with Cargo

When the Rust compiler compiles the source files, it generates something known as an object file. The object file takes the source file (which we can read and understand) and compiles this into a form that can be joined with other libraries to create a binary.

This is a good idea, as it cuts down on compilation time; if a source file has not been changed, there is no need to recompile the file, as the object file will be the same.

Sometimes, the object file becomes out of date, or code in another object file causes a panic due to conflicts. In this case, it is not uncommon to "clean" the build. This removes the object files, and the compiler then has to recompile all the source files.

Also, it should always be performed prior to creating a release build.

The standard Unix make program performs this with the clean command (make clean). Cargo performs the clean operation in a way similar to the make utility in Unix:

cargo clean  

A comparison of the directories shows what happens when using the preceding Cargo command:

The entire target directory structure has simply been removed (the preceding screenshot was from a Mac, hence the dSYM and plist files. These do not exist on Linux and Windows).

主站蜘蛛池模板: 庆元县| 浦北县| 镇赉县| 宜宾县| 杭州市| 巴楚县| 汝阳县| 静海县| 贵港市| 梧州市| 五寨县| 神农架林区| 桐梓县| 军事| 宜君县| 贵阳市| 大新县| 吴川市| 尚志市| 吴江市| 花莲市| 卓资县| 兰西县| 天门市| 清新县| 尚义县| 赤城县| 海安县| 杭锦后旗| 通道| 彩票| 大埔区| 湟源县| 镇坪县| 佛教| 类乌齐县| 大名县| 新和县| 施秉县| 钦州市| 宁海县|