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

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

主站蜘蛛池模板: 襄樊市| 正镶白旗| 尼勒克县| 清河县| 布拖县| 开封县| 谢通门县| 桦甸市| 察雅县| 阿尔山市| 大石桥市| 娄底市| 合水县| 建平县| 建昌县| 南安市| 洛扎县| 宜丰县| 屏南县| 防城港市| 广汉市| 金堂县| 定边县| 凤冈县| 黄石市| 蕉岭县| 新丰县| 武夷山市| 厦门市| 张家川| 那曲县| 蕉岭县| 灌阳县| 卓资县| 营山县| 永济市| 札达县| 汝南县| 盐津县| 十堰市| 天柱县|