November 2017
Intermediate to advanced
264 pages
5h 45m
English
How should we use libraries written by others (choosing from the multitude of libraries available at https://crates.io) in our project? Cargo makes this very easy.
Suppose we want to use both the log and the mac library in the monsters project. log is a simple logging framework that gives us a number of macros such as info!, warn!, and trace! to log information messages. mac is a collection of useful macros, maintained by Jonathan Reem.
To get these libraries, we edit our Cargo.toml configuration file and add a [dependencies] section when it isn't already present. Beneath it, we specify the versions of the libraries we want to use:
[dependencies] log = "0.3" mac = "*"
A * denotes that any version is OK, ...
Read now
Unlock full access