
Rust All-in-One For Dummies
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
Your guide to the programming language that's revolutionizing software development
Ready to learn Rust, the language that combines blazing performance with memory safety? Rust All-in-One For Dummies takes you from complete beginner to confident developer, covering the essentials of writing Rust code through applying it to real-world projects.
Unlike programming books that throw you into the deep end, Rust All-in-One For Dummies builds your skills systematically. Each mini-book contained in this All-in-One reference focuses on a specific aspect of Rust development, complete with hands-on projects that apply what you've learned. You'll move seamlessly from understanding basic syntax to building real-world applications that showcase Rust's incredible versatility. Whether you're writing your first line of code or adding Rust to your programming toolkit, you'll discover how to harness its unique features to build everything from command-line tools to web applications.
Get expert insight on:
- Rust fundamentals and real-world applications - Learn ownership, borrowing, and the borrow checker while building practical projects like number guessing games, file organizers, chat servers, and data analysis dashboards.
- Advanced development across multiple domains - Create command-line tools, WebAssembly browser applications, networked programs, desktop GUIs, and high-performance web servers using Rust's growing ecosystem.
- Professional development practices - Master testing, documentation, error handling, concurrency, and code organization techniques that make Rust applications production-ready and maintainable.
Perfect for complete beginners starting their programming journey and experienced developers ready to explore why Rust consistently ranks as the most loved programming language. Join the community that's discovered Rust isn't just another language - it's the future of safe, fast, and reliable software development.
More details
Other editions
Additional editions

Person
Paul McFedries is an experienced programmer and technology author. He has written more than 100 books, including Coding For Dummies and HTML, CSS, & JavaScript All-in-One For Dummies, and is an expert in app and web development, operating systems, and programming languages.
Content
Introduction 1
Book 1: Welcome to the Rust Side 5
CHAPTER 1: Getting to Know Rust 7
CHAPTER 2: Getting Your Hands Rusty 17
CHAPTER 3: Speaking Rust: The Basics 39
CHAPTER 4: Crafting Expressions 61
CHAPTER 5: Controlling the Flow 77
CHAPTER 6: Pattern Matching: The Swiss Army Knife of Rust 93
CHAPTER 7: Functions: Teaching Rust New Tricks 107
Book 2: Learning the Rust Way of Doing Things 131
CHAPTER 1: Ownership: Rust's Secret Sauce 133
CHAPTER 2: Structs: Rolling Your Own Types 159
CHAPTER 3: Enums: Embracing Possibilities 177
CHAPTER 4: Storing Data in Rust 197
CHAPTER 5: The String Section: Text in Rust 225
CHAPTER 6: Functional Programming with Closures and Iterators 253
CHAPTER 7: Organizing Your Code 279
Book 3: Deeper Rust Concepts 303
CHAPTER 1: Traits: Shared Behaviors 305
CHAPTER 2: Generics: Code That Works for Almost Anything 325
CHAPTER 3: Lifetimes: How Long Things Live 343
CHAPTER 4: Handling Errors Like a Pro 361
CHAPTER 5: Macros: When Code Writes Code 381
CHAPTER 6: Parallelism and Concurrency: Rust Multitasking 395
CHAPTER 7: Testing, Debugging, and Documenting 421
Book 4: Building Command-Line Tools 447
CHAPTER 1: Coding Your First Tools 449
CHAPTER 2: File Processing and Configuration 465
CHAPTER 3: Polishing Your Command-Line Tools 487
Book 5: WebAssembly: Rust in Your Browser 503
CHAPTER 1: WebAssembly Basics and Setup 505
CHAPTER 2: Exchanging Data between Rust and JavaScript 525
CHAPTER 3: Building Interactive WebAssembly Apps 545
Book 6: Networking with Rust 569
CHAPTER 1: Building a Web Server 571
CHAPTER 2: Building a REST API 593
CHAPTER 3: Building a Server-Side Web App 617
Index 645
Chapter 1
Getting to Know Rust
IN THIS CHAPTER
Understanding how programming works
Learning what Rust brings to the programming table
Exploring what you can do with Rust
Tempering your expectations
It's ridiculous that we computer people couldn't even make an elevator that works without crashing!
-GRAYDON HOARE (INVENTOR OF RUST)
Just as I was getting started writing this book, the good folks at Stack Overflow (a popular question-and-answer site for programmers) announced the results of their 2025 survey of their users. In the "most admired programming language" category, the winner was - can I get a drumroll, please? - Rust! Rust won the same category in 2024, 2023, 2022, and, well, every single year all the way back to 2016! Yes, that's right: In a world where it seems that programmers never agree on anything, they have agreed for ten straight years that Rust is awesome.
This near-universal love of Rust convinced me a few years ago to learn the language, and I hope it provides you with the same inspiration as you start your Rust adventure. People admire Rust because it's an elegant, powerful, and empowering language that enables beginners and pros alike to create amazing things.
This chapter is your gentle introduction to Rust. You discover what problems Rust solves, what makes Rust unique, and what you can do with Rust.
Programming: Making a Computer Do Your Bidding
A computer is a machine that follows instructions. Or, to put a finer point on it, a computer is a machine that does nothing until someone or something tells it what to do. That might sound surprising. After all, computers cost many hundreds, sometimes even thousands, of dollars, and are positively bristling on the inside with electronic gadgetry. Surely something so expensive and so complex must be capable of doing some useful tasks on its own.
Nope.
Computers must be told what to do, and the way you tell a computer what to do is through code. Am I talking about making a computer do anything you want? Alas, no, although that would be very useful! When you code, you're given a set of tools for the job, and the tools you work with vary depending on the language you're using.
But no matter how you code - no matter what programming tools you have at your disposal - you're almost always doing one (or sometimes both) of the following:
- Solving a problem: One of the most common reasons why a piece of code gets written is because the coder had a pain point or an inefficiency in their life and saw a way to use code to make their life easier or more streamlined.
- Creating something: Another common reason to start coding is when you get a great idea and want more than anything to bring that idea to life.
No matter what you work on in your coding career, you're almost always doing one (or both) of these things - solving problems, creating stuff, or combining the two to make something that's both new and improved.
What is a programming language?
Rust is a programming language. Okay, fine, but what does it mean to call something a programming language? To understand this term, you need look no further than the language you use to speak and write. At its most fundamental level, human language is comprised of two things - words and rules:
- Words are collections of letters that have a common meaning among all the people who speak the same language. For example, the word book denotes a type of object; the word heavy denotes a quality; and the word read denotes an action.
- Rules are the ways in which words can be combined to create coherent and understandable concepts. If you want to be understood by other speakers of the language, you have only a limited number of ways to throw two or more words together. "I read a heavy book" is an instantly comprehensible sentence, but "book a I read heavy" is nonsensical.
The key goal of human language is being understood by someone else who is listening to you or reading something you wrote. If you use the proper words to refer to things and actions and if you combine words according to the rules, the other person will understand you.
A programming language works in more or less the same way. That is, it, too, has words and rules:
- Words are a set of terms that refer to the specific things that your program works with or the specific ways in which those things can be manipulated. These words are known as reserved words or keywords.
- Rules are the ways in which the words can be combined to produce the desired effect. In the programming world, these rules are known as the language's syntax.
Programming languages, like human languages, also have the goal of being understood, but with a crucial difference: While a human listener might understand you even if you muddle your grammar ("Me want coffee"), a computer has zero tolerance for ambiguity. Every word must be correct, and every rule must be followed exactly, or the program won't work at all.
The role of programming languages
Let's say you travel to Igboland in Nigeria and want to ask a local for directions to the nearest bathroom. If that person speaks only Igbo (the native language of Igboland), one solution would be to find someone who speaks both English and Igbo and ask that person to translate your request as well as the response. Problem solved!
The person who can translate your English into Igbo is called an interpreter, and that task is essentially how we're able to program a computer. The problem is that a computer understands only its native language, which is called machine language and consists of 1s and 0s. (I won't get into this topic here, but if you're curious to know more, check out the sidebar "Memory 101: 1s and 0s.") A very simple machine-language program might look something like this:
10111000 00000001 00000000 00000000 00000000
10111111 00000001 00000000 00000000 00000000
01001000 10111110 00000000 01100000 01100000
00000000 00000000 00000000 00000000 00000000
10111010 00001101 00000000 00000000 00000000
00001111 00000101 10111000 00111100 00000000
00000000 00000000 00110001 11111111 00001111
00000101
Yikes! No sane human wants to deal with something as weird as machine language, so one of the first things that engineers did after computers were invented was come up with two remarkable inventions:
- A way of representing machine-language instructions as human-understandable English words.
- A way of converting those English words back into the machine language that the computer understands.
The first invention is called a programming language and consists of, in part, English (or, sometimes, English-like) words such as if, loop, and match. You use these generally comprehensible terms to construct statements, which are commands that you want the computer to carry out on your behalf.
For example, the preceding machine-language code began life, in part, as the following statement:
printf("Hello, world!");
This statement outputs the text Hello, world! and is written in the C programming language. C is an example of a high-level language, which describes any programming language that abstracts away the mind-numbing complexity of the computer's native machine language.
MEMORY 101: 1S AND 0S
You might have heard someone say, with great authority, that "computers operate by processing 1s and 0s." If, upon hearing that, you were flummoxed, let me tell you that your reaction is utterly normal. It really is incomprehensible to us mere mortals that computers perform their wonders by slinging around just two values: 1 and 0. What's behind this mystery?
At the lowest level, a computer is a collection of billions of unimaginably teensy components called transistors, which operate as on/off switches for electrical current. When a transistor allows electrical current to pass through, that state is represented by a 1. When a transistor blocks electrical current from passing through, that state is represented by a 0. Each 1 or 0 is called a binary digit, or bit. One bit offers only two options: 1 or 0. Combining two bits offers four options: 00, 01, 10, or 11. Skipping ahead, I can tell you that combining eight bits offers 256 options, from 00000000 to 11111111 and every combo in between. A string of eight bits is called a byte and the 256 possible byte values is enough to code every letter, every number, every punctuation mark, plus a few other standard symbols that make up the American Standard Code for Information Interchange (ASCII) table. The uppercase letter H, for example, is 01001000 in binary. So, combine eight bits, set them so that they form the byte 01001000, and you've got the letter H stored on your circuit board (which might be a memory module).
Do you need to memorize the byte values for every letter, number, and symbol to code a computer?...
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.