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 using type inference, 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, and we will often refer to it as a resource for digging deeper into the Rust programming language.
Let's start unpacking the complicated statement above! There are several highlighted concepts in this sentence:
- ahead-of-time compiled
- multi-paradigm
- statically-typed
- type inference
- 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.