- Mastering Rust
- Rahul Sharma Vesa Kaihlavirta
- 208字
- 2021-07-02 13:35:19
Cargo and crates
When projects get large, a usual practice is to refactor code into smaller, more manageable units as modules or libraries. You also need tools to render documentation for your project, how it should be built, and what libraries it depends on. Furthermore, to support the language ecosystem where developers can share their libraries with the community, an online registry of some sort is often the norm these days.
Cargo is the tool that empowers you to do all these things, and https://crates.io is the centralized place for hosting libraries. A library written in Rust is called a crate, and crates.io hosts them for developers to use. Usually, a crate can come from three sources: a local directory, an online Git repository like GitHub, or a hosted crate registry like crates.io. Cargo supports crates from all of these sources.
Let's see Cargo in action. If you ran rustup, as described in the previous chapter, you will already have cargo installed, along with rustc. To see what commands are available to us, we can run cargo without any parameters:

It shows a list of common commands that we can use, along with some flags. Let's use the the new subcommand to create a new Cargo project.
- DevOps:軟件架構師行動指南
- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- Three.js開發指南:基于WebGL和HTML5在網頁上渲染3D圖形和動畫(原書第3版)
- Learn WebAssembly
- Python數據可視化之Matplotlib與Pyecharts實戰
- Hands-On Enterprise Automation with Python.
- HTML5入門經典
- Expert Data Visualization
- Python編程從0到1(視頻教學版)
- Mastering ROS for Robotics Programming
- 軟件測試實用教程
- 響應式架構:消息模式Actor實現與Scala、Akka應用集成
- Spring Security Essentials
- Web性能實戰
- SQL Server 2016 從入門到實戰(視頻教學版)