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

  • 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.

主站蜘蛛池模板: 楚雄市| 株洲县| 奉新县| 晋城| 兴仁县| 北票市| 蓝田县| 中山市| 视频| 安康市| 高青县| 海口市| 得荣县| 噶尔县| 榆社县| 霸州市| 弋阳县| 凌海市| 大城县| 仪陇县| 英超| 筠连县| 民权县| 宁夏| 玛曲县| 仪陇县| 武隆县| 桐梓县| 越西县| 三门峡市| 元朗区| 阆中市| 双牌县| 天祝| 平度市| 朔州市| 孝昌县| 浑源县| 慈利县| 邻水| 错那县|