Managing a software project with Cargo
When compiling Rust code, the Rust compiler goes through similar steps to C and C++. Rust files are compiled into object files using optimization techniques. These object files are then linked with required libraries, and a binary output file is produced. Lucky for us, these processes are hidden unlike C and C++, making it easier. Before we explore the package manager that is Cargo, we must cover how to perform basic Rust compilation.
Basic Rust Compilation
We should start by building a basic single-file application. To do this, we initially must create a file called hello_world.rs
in a local directory to house the Rust code that we are going to compile.
The
.rs
extension denotes that the file is a Rust file. To be honest, it does not matter what the extension is. If there is viable Rust code written in that file, the compiler will compile and run it without any issues. However, having different extensions might confuse other developers and code...