2. A general introduction to Rust and its concepts compared to C++

The Rust programming language is an ahead-of-time compiled, multi-paradigm programming language that is statically typed, uses borrow checking for enforcing memory safety and supports ad-hoc polymorphism through traits, among other features.

This definition is quite the mouthful of fancy words. In this chapter, we will try to understand the basics of what these features mean, why they are useful in systems programming, and how they relate to similar features present in C++. We will dive deeper into some of Rusts features in the later chapters, however we will always do so by keeping the systems programming aspect in mind. The Rust book does a fantastic job at teaching the Rust programming language in general, so refer to it whenever you want to know more about a specific Rust feature or are confused about a piece of syntax or a specific term.

Let's start unpacking the complicated statement above! There are several highlighted concepts in this sentence:

  • ahead-of-time compiled
  • multi-paradigm
  • statically-typed
  • borrow checking
  • ad-hoc polymorphism
  • traits

Over the next sections, we will look at each of these keywords together with code examples to understand what they mean and how they relate to systems programming.