Share E-Book
Scan to open this page

Scan with your phone to open this page

AuthorRic Messier

Quickly learn the ropes with the Rust programming language using this practical, step-by-step guide In Beginning Rust Programming, accomplished programmer and author Ric Messier delivers a highly practical, real-world guide to coding with Rust. Avoiding dry, theoretical content and “Hello, world”-type tutorials of questionable utility, the book dives immediately into functional Rust programming that takes advantage of the language’s blazing speed and memory efficiency. Designed from the ground up to give you a running start to using the multiparadigm system programming language, this book will teach you to: * Solve real-world computer science problems of practical importance * Use Rust’s rich type system and ownership model to guarantee memory-safety and thread-safety * Integrate Rust with other programming languages and use it for embedded devices Perfect for programmers with some experience in other languages, like C or C++, Beginning Rust Programming is also a great pick for students new to programming and seeking a user-friendly and robust language with which to start their coding career.

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, project-driven introduction to Rust that skips "Hello, world" and teaches the language by building a working Conway's Game of Life. Best for programmers coming from C, C++, or Python who want to understand ownership, types, and Cargo by writing real code. 【Book Arc】 - **Opening (~0%–9%)**: Sets up the toolchain and mindset — installing Rust via rustup rather than a Linux package manager, understanding rustc vs. cargo, and why dependency management matters. Establishes that this is a compiler-driven systems language, not a scripting language. - **Early (~9%–28%)**: Builds the Game of Life from scratch: Cargo project setup, external crates, namespaces, functions, variables, datatypes, arrays, and control structures. Introduces Rust's implicit return (last expression, no semicolon) and the freedom to place `main` anywhere in the file. - **Early–Middle (~28%–38%)**: Moves into ownership and lifetime concepts through the lens of the Game of Life — moves vs. copies, why Rust avoids garbage collection and reference counting, and how memory safety drives language design. - **Middle (~38%–47%)**: Adds real program plumbing: command-line arguments, `Option` types and `unwrap()`, reading from files, populating vectors, and terminal output with color via external crates. Contrasts Rust references with C pointers and dereferencing. - **Late (~47%+)**: Extends the project with modules, generation printing, and iteration over generations. The excerpts do not cover the later chapters in detail, so the book's treatment of concurrency, FFI, and embedded work is only signaled by the blurb. 【Key Takeaways】 - **Cargo is the center of the Rust workflow** (Opening): it compiles, manages dependencies, and resolves modules automatically — unlike C, where you manually link libraries. Learn it early and use it instead of rustc directly. - **Ownership replaces garbage collection and reference counting** (Early–Middle): when a value is assigned to a new variable, it is *moved*, not copied, preventing two aliases from pointing at the same memory. This is the core mental shift for readers coming from Java or Python. - **Rust returns values implicitly** (Early): the last expression in a function — without a semicolon — becomes the return value. This distinction between statements and expressions recurs throughout the language. - **Option types force you to handle absence** (Middle): functions like `nth()` return `Option`, and calling `unwrap()` on `None` panics. This is the book's first taste of Rust's error-handling philosophy. - **References work opposite to C pointers** (Middle): `&` passes a reference to a value rather than an address, and the compiler enforces safe usage. The book uses side-by-side C and Rust examples to make this concrete. - **External crates are first-class** (Early–Middle): the `rand` and `color` crates are pulled in and used with explicit scoping, showing how Rust's ecosystem integrates without manual installation steps. - **The Game of Life is the teaching vehicle** (Early–Late): each concept — arrays, loops, functions, ownership, file I/O — is introduced because the project needs it, not as an abstract exercise. 【Reading Tips】 - **Deep-read Chapters 1–2**: the Game of Life implementation is the spine of the book. Type the code yourself rather than reading it passively; the ownership and reference material only clicks when you hit compiler errors. - **Skim the C/Python comparisons if you already know those languages** — they are useful for intuition but not essential to writing Rust. - **Pause on ownership and references** (Early–Middle): these are the hardest conceptual jumps. If you rush, later chapters on modules and file I/O will feel arbitrary. - **Treat the exercises at the end of each chapter as mandatory** — the book is explicitly practical, and the exercises extend the Game of Life in ways that reinforce the chapter's concepts. - **Keep the Rust compiler handy**: the book leans on compiler feedback as a teaching tool, so build frequently and read error messages carefully. 【Coverage Limits】 The excerpts cover roughly the first half of the book, centered on the Game of Life project, ownership, and basic I/O. Later topics promised by the blurb — concurrency, thread safety, FFI, and embedded devices — are not covered in the available excerpts, so this guide cannot assess their depth or quality.
Page 8
ive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John...
View in text
Excerpt 2
ny function for that matter, wherever in the file you want. The compiler won’t error on you simply because of that. DISSECTING MAIN We’re going to the bottom...
View in text
Excerpt 3
ly, for example, C compilers will generate a file called a.out when you compile without specifying an output filename. This is an artifact of the executable...
View in text
Excerpt 4
int main () { int x = 10; printf("%d\n", twice(x)); readin(&x); return 0; } In the main function, the variable x is declared as an integer. No problem, becau...
View in text
Excerpt 5
f: &String) -> Dvd { let file = File::open(f).unwrap(); let deserialized_json: Dvd = serde_json::from_reader(file).unwrap(); deserialized_json } Since we are...
View in text
Excerpt 6
println!("Incorrect! You are at {}", next_part); if next_part == "right foot" { body_complete = true; } } } Err(error) => { println!("Didn't get any input");...
View in text
Excerpt 7
ile.unwrap(); if let Ok(file) = read_file(&entry) { let msg = format!("{} : {:x}", entry.path().to_str().unwrap(), Sha256::digest(file.as_bytes())); side2.wr...
View in text
Excerpt 8
with the server. Port 32561 172.17.42.84 Port 443 4.8.5.92 FIGURE 6.4: Network envelope So, now you understand the network bits at a conceptual level. Let’s...
View in text
Tags
AI categories
Programming LanguageRustProgramming
ISBN: 1119712971
Publisher: Wrox / Wiley
Publish Year: 2021
Language: English
Pages: 416
File Format: PDF
File Size: 8.1 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…