1.1 Why Rust?
Rust is a modern programming language that uniquely combines high performance with safety. Although concepts like ownership and borrowing can initially seem challenging, they enable developers to write efficient and reliable code. Rust's syntax may appear unconventional to those accustomed to other languages, yet it offers powerful abstractions that make it easier to create robust software.
So why has Rust gained popularity despite its complexities?
Rust aims to balance the performance benefits of low-level systems programming languages with the safety, reliability, and user-friendliness of high-level languages. Low-level languages like C and C++ offer high performance with minimal resource usage but can be prone to errors that affect reliability. High-level languages such as Python, Kotlin, Julia, JavaScript, C#, and Java are easier to learn and use but often rely on garbage collection and large runtime environments, making them less suitable for certain systems programming tasks.
Languages like Rust, Go, Swift, Zig, Nim, Crystal, and V seek to bridge this gap. Rust has been particularly successful, as shown by its growing popularity.
As a systems programming language, Rust enforces memory safety through its ownership model and borrow checker, preventing issues such as null pointer dereferencing, use-after-free, and buffer overflows—without using a garbage collector. Rust avoids hidden, expensive operations like implicit type conversions or unnecessary heap allocations, giving developers precise control over performance. Copying large data structures is typically avoided by using references or move semantics to transfer ownership. When copying is necessary, developers must explicitly request it with functions like clone()
. Despite these performance-focused constraints, Rust provides conveniences such as iterators and closures, offering a user-friendly experience while retaining high efficiency.
Rust's ownership model also guarantees fearless concurrency by preventing data races at compile time, simplifying the creation of concurrent programs compared to languages that detect such errors at runtime—or not at all.
Although Rust does not use a traditional class-based object-oriented programming (OOP) approach, it incorporates OOP concepts via traits and structs, supporting polymorphism and code reuse in a flexible manner. Rust replaces exceptions with Result
and Option
types for error handling, encouraging explicit handling and avoiding unexpected runtime failures.
Rust’s development started in 2006 with Graydon Hoare, initially with volunteer help and later sponsored by Mozilla. The first stable version, Rust 1.0, was released in 2015. By version 1.84 and the Rust 2024 edition, stabilized in early 2025, Rust had continued to evolve while maintaining backward compatibility. Today, Rust benefits from a large, active developer community. After Mozilla scaled back its involvement, the Rust community formed the Rust Foundation, supported by AWS, Google, Microsoft, Huawei, and others, to ensure continued growth and sustainability. Rust is free, open-source software licensed under permissive MIT and Apache 2.0 terms for its tools, standard library, and most external packages.
Rust’s community-driven development process relies on RFCs (Requests for Comments) to propose and discuss new features. This open, collaborative approach has fueled Rust’s rapid growth and created a rich ecosystem of libraries and tools. The community’s emphasis on quality and collaboration has turned Rust from just a programming language into a movement advocating safer, more efficient development.
Well-known companies such as Facebook, Dropbox, Amazon, and Discord use Rust for various projects. Dropbox, for example, uses Rust to optimize file storage, while Discord relies on it for high-performance networking. Rust is also used in system programming, embedded systems, WebAssembly development, and building applications for PCs (Windows, Linux, macOS) and mobile platforms. Another milestone is Rust’s integration into the Linux kernel—the first time an additional language has been adopted alongside C. Rust is also gaining momentum in the blockchain industry.
Rust’s ecosystem is mature and well-supported. It features a powerful compiler, the modern Cargo build system, and Crates.io, an extensive repository of open-source libraries. Tools like rustfmt
for formatting and clippy
for linting help keep Rust code clean and consistent. Modern GUI frameworks such as EGUI and Xilem, game engines like Bevy, and entire operating systems such as Redox-OS are available in the Rust ecosystem.
As a statically typed, compiled language, Rust historically might not have been a top choice for rapid prototyping, where dynamically typed, interpreted languages (e.g., Python or JavaScript) have often excelled. However, Rust’s increasingly faster compile times—improved by incremental compilation and build artifact caching—together with its robust type system and strong IDE support, have made prototyping in Rust more efficient. Many developers now select Rust for its performance, safety guarantees, and straightforward path from prototypes to production-ready applications.
Since this book assumes familiarity with Rust’s main features, we will not analyze Rust's pros and cons further. Instead, we focus on its core features and its established ecosystem. The LLVM-based compiler (rustc
), the Cargo package manager, Crates.io, and Rust’s large community are essential factors behind its growing importance.