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

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

Cargo and crates.io

A very important thing to note with Rust's ecosystem is that Cargo is really important if not central. It makes things much easier and all Rust projects are using it.

Cargo isn't only a build tool, it's also Rust's default package manager. If you need to download a dependency, Cargo will do it. You can find all available published crates on https://crates.io/. Consider the following screenshot:

Figure 2.1

In the case of the sdl2 crate, we can see on its page (https://crates.io/crates/sdl2) some interesting and useful information:

Figure 2.2

On the right-hand side, you can see the version history. It can be useful to check whether you have the last version or not and whether the crate is still maintained.

In the middle, you have the crate's dependencies. It's always interesting to know what you'll need to install in addition to your crate if something is missing.

And finally on the left-hand side, you have a few links that might be very useful (not always those ones, it depends on what has been put into the Cargo.toml file):

  • Documentation: This is where the documentation is hosted (even though I generally recommend docs.rs, I'll talk about it in a moment)
  • Repository: This is where this crate's repository is hosted
  • Dependent crates: This is the list of the crates depending on this one
  • Homepage: If the crate has a website, you can go to its link

Time to go back to docs.rs for a bit.

主站蜘蛛池模板: 江阴市| 武宁县| 南靖县| 滦平县| 湖北省| 偏关县| 东至县| 阿荣旗| 泗水县| 潮州市| 修文县| 永德县| 梅河口市| 宣汉县| 田林县| 白玉县| 宜兰县| 阿荣旗| 称多县| 丰原市| 广宁县| 荥阳市| 轮台县| 康保县| 海宁市| 新余市| 汪清县| 陵川县| 高台县| 谢通门县| 沅陵县| 米泉市| 故城县| 三门峡市| 岳普湖县| 湘潭县| 昌平区| 永寿县| 绥芬河市| 雅安市| 延川县|