Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Timothy Samuel McNamara

Rust in Action introduces the Rust programming language by exploring numerous systems programming concepts and techniques. You'll be learning Rust by delving into how computers work under the hood. You'll find yourself playing with persistent storage, memory, networking and even tinkering with CPU instructions. The book takes you through using Rust to extend other applications and teaches you tricks to write blindingly fast code. You'll also discover parallel and concurrent programming. Filled to the brim with real-life use cases and scenarios, you'll go beyond the Rust syntax and see what Rust has to offer in real-world use cases. About the technology Rust is the perfect language for systems programming. It delivers the low-level power of C along with rock-solid safety features that let you code fearlessly. Ideal for applications requiring concurrency, Rust programs are compact, readable, and blazingly fast. Best of all, Rust’s famously smart compiler helps you avoid even subtle coding errors. About the book Rust in Action is a hands-on guide to systems programming with Rust. Written for inquisitive programmers, it presents real-world use cases that go far beyond syntax and structure. You’ll explore Rust implementations for file manipulation, networking, and kernel-level programming and discover awesome techniques for parallelism and concurrency. Along the way, you’ll master Rust’s unique borrow checker model for memory management without a garbage collector. What's inside • Elementary to advanced Rust programming • Practical examples from systems programming • Command-line, graphical and networked applications About the reader For intermediate programmers. No previous experience with Rust required. About the author Tim McNamara uses Rust to build data processing pipelines and generative art. He is an expert in natural language processing and data engineering.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on tour of systems programming that teaches Rust by building real things—file tools, memory models, network clients, and low-level CPU tricks—so intermediate programmers can move past syntax into how computers actually work. Best for developers with some programming experience who want Rust's safety model explained through concrete projects rather than abstract theory. 【Book Arc】 - **Opening (~0%–10%)**: Sets up the toolchain and mindset—`cargo` as build system and package manager, project layout, and why Rust's strict compiler is a feature, not a hurdle. Frames the book's gradual approach to a large language. - **Early (~10%–30%)**: Language foundations—numeric types and literals, flow control (`for`, `match`), strongly typed functions, generics with trait bounds, and a first real project (a `grep`-style search tool using regex and CLI argument parsing). - **Early–Middle (~30%–45%)**: Distinctives of Rust's type system—modeling files with structs, defining behavior with traits (`Read`, `PartialEq`), and the borrow checker's aliasing rules, including the `let` vs `const` distinction and interior mutability. - **Middle (~45%–60%)**: Systems-level concerns—interacting with OS globals like `errno`, inspecting CPU flags, and the discipline of type-safe error handling versus raw integer error codes. - **Late (~60%–90%)**: Applied systems programming—persistent storage, memory, networking, extending other applications, and techniques for fast code. (Excerpts do not cover the specific chapter-by-chapter breakdown here.) - **Ending (~90%–100%)**: Advanced low-level work—CPU instructions, signals, and exception handling via deeply nested call stacks (the `sjlj` project), plus a candid note on portability and revising how we think about exceptions. 【Key Takeaways】 - **`cargo` is both build system and package manager** (Opening): it compiles, runs, and manages dependencies, with `Cargo.toml` for metadata and `Cargo.lock` pinning exact versions for reproducible builds. - **The compiler is strict but helpful** (Early): Rust surfaces errors like misnamed variables and data races at compile time, so users don't hit them at runtime—an adjustment for dynamic-language programmers. - **Rust is large; learn it gradually** (Early): a rich type system and dozens of keywords create a steep curve, so the book defers advanced concepts and starts with a minimal subset. - **Rust is not a security panacea** (Early): case studies like Heartbleed and `goto fail;` show Rust would likely have helped, but similar bugs remain possible—memory safety is a tool, not a guarantee. - **Traits define shared behavior** (Middle): once you understand what `PartialEq` does for one type, you understand it for every type; `for` loops are shorthand for `IntoIterator`, and math relies on traits like `Add`. - **`let` is about aliasing, not just immutability** (Middle): read-only borrows may alias, mutable borrows never do; types like `Arc` and `Rc` present an immutable façade while changing internal state (interior mutability). - **Systems programming means respecting OS conventions** (Middle): global `errno`, CPU flags, and register inspection are common even when Rust would prefer type-safe errors—worth knowing for low-level work. - **Real projects cement the concepts** (Early–Middle): building `grep-lite` with regex, `clap` argument parsing, and generic `BufRead` readers shows how traits, generics, and I/O fit together in practice. 【Reading Tips】 - **Deep-read the type-system chapters** (structs, traits, borrow checker): these are the conceptual core; skimming them will make later systems chapters feel arbitrary. - **Skim the toolchain setup** if you already know `cargo`; the value is in the project structure conventions, not the commands. - **Type out the projects**—`grep-lite` and the `sjlj` exception-handling exercise—rather than reading listings; the borrow checker's lessons land only when you hit its errors yourself. - **Treat the security case studies as calibration**, not trivia: they set realistic expectations about what Rust prevents and what it doesn't. - **Don't fear the deferred advanced material**; the book intentionally sequences concepts, so trust the order and revisit earlier chapters when later ones reference them. 【Coverage Limits】 The excerpts cover the book's framing, early language foundations, type-system distinctives, and the ending's low-level exception-handling material, but the middle-to-late applied chapters (persistent storage, networking, extending applications, performance tricks) are only summarized at the blurb level. Specific chapter titles and detailed content for those sections are not available in the excerpts.
Excerpt 1
Rust to build data processing pipelines and generative art. He is an expert in natural language processing and data engineering. Systems programming concepts...
View in text
Excerpt 2
ignated as CVE-2014-0160,16 was caused by re-using a buffer incorrectly. A buffer is a space set aside in memory for receiving input. Data can leak from one...
View in text
Excerpt 3
:new(10, 0) a duration between two points in time 14 ); 15 Because std::time::Duration does 16 println!("{}", floats); not implement the std::fmt::Display 17...
View in text
Excerpt 4
o 2 unused variables within functions 3 #[derive(Debug)] 4 struct File; Defines a stub File type 5 6 trait Read { P r o vides a specific 7 fn read( name for...
View in text
Excerpt 5
an implementation impl Clone for CubeSat { of Clone. fn clone(&self) -> Self { CubeSat { id: self.id } If desired, we can write out } the creation of a new o...
View in text
Excerpt 6
other programs through Rust’s foreign function interface. 6.1 Pointers Pointers are how computers refer to data that isn’t immediately accessible. This topic...
View in text
Excerpt 7
cope. These are often called anonymous or lambda functions. Closures are a common feature within idiomatic Rust code, but this book tends to avoid those wher...
View in text
Excerpt 8
the chapter and also introduces the main library code. The library code will not change as the subsequent two systems are built on top of it. Before we get t...
View in text
Tags
AI categories
RustProgramming LanguageSystems Programming
ISBN: 1617294551
Publish Year: 2021
Language: English
Pages: 456
File Format: PDF
File Size: 18.3 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…