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

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

主站蜘蛛池模板: 北宁市| 顺平县| 南部县| 彝良县| 永胜县| 开封县| 绥棱县| 南投市| 延长县| 台山市| 雷州市| 车险| 庄浪县| 许昌市| 昆明市| 余干县| 共和县| 孟津县| 九龙坡区| 兴山县| 黔南| 宁海县| 应用必备| 启东市| 衡南县| 拉萨市| 乌兰察布市| 金塔县| 勃利县| 宜春市| 永川市| 南岸区| 渑池县| 龙岩市| 鄱阳县| 洪湖市| 随州市| 新泰市| 弥渡县| 阜康市| 德惠市|