For several consecutive years, Rust has been voted "most loved programming language" in Stack Overflow's annual developer survey. This open source systems programming language is now used for everything from game engines and operating systems to browser components and virtual reality simulation engines. But Rust is also an incredibly complex language with a notoriously difficult learning curve.
Rather than focus on the language as a whole, this guide teaches Rust using a single small, complete, focused program in each chapter. Author Ken Youens-Clark shows you how to start, write, and test each of these programs to create a finished product. You'll learn how to handle errors in Rust, read and write files, and use regular expressions, Rust types, structs, and more.
Discover how to
Use Rust's standard libraries and data types such as strings, vectors, dictionaries, and sets to create systems programs
Write and test Rust programs and functions
Read and write files, including stdin, stdout, and stderr
Document and validate command-line arguments
Write programs that fail gracefully
Parse raw and delimited text as well as Excel data
Use and control randomness
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A hands-on Rust primer that teaches the language by rebuilding familiar Unix command-line tools, one small, fully tested program per chapter. Best for programmers who know another language and want practical Rust fluency rather than a reference.
【Book Arc】
- **Opening (~0%–10%)**: Frames the book's philosophy—learning by writing complete programs, not passive reading—and introduces Rust's origins, memory safety, static typing, and why it matters for systems work.
- **Early (~10%–30%)**: Sets up the toolchain (rustup, Cargo, rustfmt), the book's GitHub repo, and the test-driven workflow you'll reuse in every chapter.
- **Middle (~30%–55%)**: Begins the project sequence with a first "Hello, world" program, then moves into organizing projects, compiling with rustc, and using Cargo to scaffold, build, and test.
- **Late (~55%–85%)**: The core of the book—writing Rust versions of Unix tools like head and cal, handling arguments, reading inputs, and applying patterns for validation, file I/O, and parsing. (Excerpts do not cover the specific later chapters in detail.)
- **Ending (~85%–100%)**: Consolidates the recurring patterns—argument handling, error handling, text parsing, randomness—so you can apply them to your own CLI programs. (Excerpts do not cover the closing chapters directly.)
【Key Takeaways】
- **Learn by building, not by reading** (Opening): The book's central premise is that passively absorbing syntax teaches little; writing complete, working programs is what makes Rust stick.
- **Each chapter is a self-contained project** (Early): You start from scratch, add features, work through compiler errors, and test—mirroring real development rather than isolated snippets.
- **Tests are a first-class learning tool** (Early): The author advocates test-driven development, using provided tests to break problems into small, verifiable parts and to catch mistakes early.
- **The Rust compiler is a partner, not an enemy** (Early): Strict type checking prevents basic errors; when a Rust program compiles, it usually works as intended, which reduces debugging effort.
- **Rust binaries are easy to share and deploy** (Early): Compiled executables run without installing Rust or dependencies, and produce far smaller containers than interpreted-language equivalents.
- **Unix command-line concepts are part of the curriculum** (Opening): Exit values, arguments, STDIN/STDOUT/STDERR, redirection, and pipes are taught alongside Rust, making the tools and the language mutually illuminating.
- **Recurring patterns emerge across projects** (Opening): Validating parameters, reading and writing files, parsing text, and using regular expressions are the reusable building blocks you'll carry into your own programs.
- **The book is a primer, not a reference** (Early): It deliberately leaves deep language details to comprehensive texts like Programming Rust and The Rust Programming Language, focusing instead on getting things done.
【Reading Tips】
- **Type every program yourself**: The book explicitly warns against passive reading; run the tests, hit compiler errors, and fix them—that's where the learning happens.
- **Deep-read the early setup chapters**: Toolchain, Cargo, and testing workflow are foundational; skimming here will cost you later.
- **Skim the licensing and O'Reilly boilerplate**: Front-matter sections on permissions and online learning add no technical value.
- **Use the book's GitHub repo alongside your own**: Clone the tests, but write your solutions in a separate repository to build good habits.
- **Pair with a language reference**: Keep Programming Rust or The Rust Programming Language nearby for the nitty-gritty the primer intentionally omits.
【Coverage Limits】
These excerpts cover the preface, setup, and early chapters in detail; the specific later projects and their exact chapter titles are not fully represented, so the Late and Ending stages are described at a general level.
Excerpt 1
al sales department: 800-998-9938 or corporate@oreilly.com . Acquisitions Editor: Suzanne McQuade Development Editors: Rita Fernando and Corbin Collins Produ...
t a Rust program to compile, it usually works as I intended. Second, it’s easy to share a Rust program with someone who doesn’t know Rust or is not a develop...
ured to automatically run rustfmt every time I save my work. I find this makes it much easier to read my code and find mistakes. I recommend you use Clippy ,...
ogram. Next, I’ll show you how to better organize your code. Organizing a Rust Project Directory In your Rust projects, you will likely write many files of s...
irectory holds the Rust source code for testing the program. All the tests in this book will use assert! to verify that some expectation is true , or assert_...
st suite to ensure that the program still works as expected. Testing the Program Output While it’s nice to know that my hello program exits correctly, I’d li...
I can read the manual page for echo by executing man echo . You’ll see that I’m using the BSD version of the program from 2003: ECHO(1) BSD General Commands...
nge the code to the following: fn main () { println ! ( "{:?}" , std :: env :: args ()); // Success at last! } Now the program compiles and prints something...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Command-Line Rust (Ken Youens-Clark)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Command-Line Rust (Ken Youens-Clark)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment