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

  • Mastering Rust
  • Rahul Sharma Vesa Kaihlavirta
  • 152字
  • 2021-07-02 13:35:21

cargo-watch

Cargo-watch helps you shorten your fix, compile, run cycle by automatically building your project in the background whenever you make changes to your code. By default, this just runs Rust's type checker (the cargo check command) and does not undergo the code generation phase (which takes time) and shortens the compile time. A custom command can also be provided instead of cargo check using the -x flag.

We can install cargo-watch by running cargo install cargo-watch, and then within any Cargo project we can run it by invoking cargo watch. Now, whenever we make changes to our project, cargo-watch will run cargo check in the background and recompile the project for us. In the following code, we made a typo and corrected it, and cargo-watch recompiled the project for us:

This will be a very similar experience if you know about the watchman or nodemon packages from the Node.js ecosystem.

主站蜘蛛池模板: 本溪| 太康县| 门源| 依安县| 滨海县| 镇江市| 弥勒县| 大埔县| 巫溪县| 镇江市| 永清县| 拜城县| 高平市| 五家渠市| 视频| 三穗县| 武威市| 新余市| 安庆市| 兖州市| 玉门市| 陵水| 六枝特区| 富锦市| 太谷县| 岑巩县| 嵩明县| 望城县| 南安市| 巴林右旗| 准格尔旗| 固安县| 平陆县| 三原县| 汶上县| 东港市| 芒康县| 金寨县| 睢宁县| 积石山| 井冈山市|