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

  • Rust Programming By Example
  • Guillaume Gomez Antoni Boucher
  • 164字
  • 2021-07-02 19:13:04

Back to our Cargo.toml file

To go back to our Cargo.toml file, it's also possible to use crates directly from their repositories; you just have to specify this when adding the dependency in your Cargo.toml file. Generally, the published version is less advanced than the one on the corresponding repository but will be more stable.

So for example, if we want to use the repository version for the sdl2 crate, we need to write in our Cargo.toml file:

[dependencies]
sdl2 = { git = "https://github.com/Rust-SDL2/rust-sdl2" }

Easy right? Cargo can also start tests or benchmarks, install binaries, handle special builds through a build file (by default in build.rs), or handle features (we'll come back to this point later in this part).

To put it simply, it's a complete tool, and explaining most of its features would take a lot of time and space, so we'll just stick to the basics for the moment.

You can find a very good documentation/tutorial on Cargo at http://doc.crates.io/index.html.

主站蜘蛛池模板: 六枝特区| 本溪| 沿河| 延川县| 青岛市| 凯里市| 达尔| 五寨县| 淮北市| 资源县| 洛川县| 白朗县| 海晏县| 哈巴河县| 醴陵市| 贞丰县| 凤山县| 三门峡市| 湖南省| 乳山市| 木兰县| 海原县| 徐闻县| 上虞市| 酉阳| 乐业县| 东海县| 墨竹工卡县| 怀集县| 永城市| 常熟市| 伊宁市| 济源市| 宁城县| 巴塘县| 延吉市| 福贡县| 光泽县| 左贡县| 洪洞县| 仁化县|