Welcome to Rust—the empowering programming language. Once you scratch its surface, you will not only find a programming language with unparalleled speed and safety, but one that is enjoyable enough to use every day.
When you begin to program in Rust, it’s likely that you will want to continue to do so. And this book, Rust in Action, will build your confidence as a Rust programmer. But it will not teach you how to program from the beginning. This book is intended to be read by people who are considering Rust as their next language and for those who enjoy implementing practical working examples. Here is a list of some of the larger examples my blog includes:
- Mandelbrot set renderer
- A grep clone
- CPU emulator
- Generative art
- A database
- HTTP, NTP, and hexdump clients
- LOGO language interpreter
- Operating system kernel
As you may gather from scanning through that list, reading this book will teach you more than just Rust. It also introduces you to systems programming and low-level programming. As you work through Rust in Action, you’ll learn about the role of an operating system (OS), how a CPU works, how computers keep time, what pointers are, and what a data type is. You will gain an understanding of how the computer’s internal systems interoperate. Learning more than syntax, you will also see why Rust was created and the challenges that it addresses.
Where is Rust used?
Rust has won the “most loved programming language” award in Stack Overflow’s annual developer survey every year in 2016-2020. Perhaps that’s why large technology leaders such as the following have adopted Rust:
- Amazon Web Services (AWS) has used Rust since 2017 for its serverless computing offerings, AWS Lambda and AWS Fargate. With that, Rust has gained further inroads. The company has written the Bottlerocket OS and the AWS Nitro System to deliver its Elastic Compute Cloud (EC2) service.
- Cloudflare develops many of its services, including its public DNS, serverless computing, and packet inspection offerings with Rust.
- Dropbox rebuilt its backend warehouse, which manages exabytes of storage, with Rust.
- Google develops parts of Android, such as its Bluetooth module, with Rust. Rust is also used for the crosvm component of Chrome OS and plays an important role in Google’s new operating system, Fuchsia.
- Facebook uses Rust to power Facebook’s web, mobile, and API services, as well as parts of HHVM, the HipHop virtual machine used by the Hack programming language.
- Microsoft writes components of its Azure platform including a security daemon for its Internet of Things (IoT) service in Rust.
- Mozilla uses Rust to enhance the Firefox web browser, which contains 15 million lines of code. Mozilla’s first two Rust-in-Firefox projects, its MP4 metadata parser and text encoder/decoder, led to overall performance and stability improvements.
- GitHub’s npm, Inc., uses Rust to deliver “upwards of 1.3 billion package downloads per day.”
- Oracle developed a container runtime with Rust to overcome problems with the Go reference implementation.
- Samsung, via its subsidiary SmartThings, uses Rust in its Hub, which is the firmware backend for its Internet of Things (IoT) service.
Rust is also productive enough for fast-moving startups to deploy it. Here are a few examples:
- Sourcegraph uses Rust to serve syntax highlighting across all of its languages.
- Figma employs Rust in the performance-critical components of its multi-player server.
- Parity develops its client to the Ethereum blockchain with Rust.
Now let's look at what you can use the Rust language for?