How it works...
By specifying the version and name in Cargo.toml, cargo can download and compile the required crates and link them into the project as needed. In fact, cargo maintains a cache for both crates on crates.io and raw git dependencies (check the ~/.cargo directory), where it puts recently used crates. This is exactly what we did in the first steps by adding dependencies of mixed origin to the crate.
One of these origins is a git repository, but can alternatively take the shape of local paths to directories. Additionally, by passing an object (as seen in the regex crate in step 1), we can specify features for a crate (as shown in the serde dependency in step 1) or use an entire section called dev-dependencies for dependencies that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access