Chapter 1: Getting Started
Today I’m going through Chapter 1: Getting Started.
Humbling as it may be, I need to understand everything being presented to me.
What is most striking to me about Rust is that the book pushes this idea about the software being alive. Continuous updates being pushed by hundreds of volunteers. I should never fear upgrading to a new stable version of Rust. This puts my mind at ease knowing this software will not be obsolete in the foreseeable future.
I will be writing everything under the stable release. I setup a Github repository which you can find here.
I’ll be using RustRover for this course. Often I have used VSCode for working with Next.js or React but this is case specific and I intend to get my hands dirty.
Luca highlights the Inner Development Loop, which is make a change, compile the app, run tests and run the app. A large chunk of this time can be cut using lld, a linker developed by the LLVM project. I’m doing this on an x86 MacBook and will be installing the the proper lld.
Then next way we can reduce the time spent in the IDL not running our app is through cargo-watch, which monitors your source code to trigger commands every time a file changes. Using the command: cargo watch -x check.
In Section 1.5 we arrive at a critical stage in any Software Engineer’s workflow - the Continuous Integration (CI) Pipeline. This is achieved through a collection of automated checks running on every commit. Luca recommends we use code coverage and employ the proper tools from llvm. We can use it with the following command: cargo llvm-cov.
Next we will be installing clippy; the official Rust linter. We can run it using cargo clippy — -D warnings. We also install rustfmt for formatting (and format the project using cargo fmt).
For security checks on crate we install cargo-audit which checks if any of our crates have known vulnerabilities.
And that’s it for the setup and the CI Pipeline! Time for Chapter 2.