2.1 Compiled Language and Build System
Like C, Rust is a compiled language, converting your human-readable source code into machine code that can be executed directly by the system. This compilation results in separate source code (text files) and binary executable files.
2.1.1 Cargo: Rust's Build System and Package Manager
Rust uses Cargo as its build system and package manager, akin to make
or cmake
in the C world, but with more features integrated by default. Cargo simplifies tasks such as compiling code, managing dependencies, running tests, and building projects.
Example of initializing a new Cargo project:
cargo new my_project
cd my_project
cargo build
This creates a new Rust project with a predefined directory structure, making it easier to manage larger codebases.