rust-book-bk6.pages.dev
Open in
urlscan Pro
2606:4700:310c::ac42:2cb6
Public Scan
URL:
https://rust-book-bk6.pages.dev/
Submission: On November 07 via api from US — Scanned from DE
Submission: On November 07 via api from US — Scanned from DE
Form analysis
1 forms found in the DOM<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
Text Content
1. The Rust Programming Language 2. Foreword 3. Introduction 4. 1. Getting Started 5. 1. 1.1. Installation 2. 1.2. Hello, World! 3. 1.3. Hello, Cargo! 6. 2. Programming a Guessing Game 7. 3. Common Programming Concepts 8. 1. 3.1. Variables and Mutability 2. 3.2. Data Types 3. 3.3. Functions 4. 3.4. Comments 5. 3.5. Control Flow 9. 4. Understanding Ownership 10. 1. 4.1. What is Ownership? 2. 4.2. References and Borrowing 3. 4.3. The Slice Type 11. 5. Using Structs to Structure Related Data 12. 1. 5.1. Defining and Instantiating Structs 2. 5.2. An Example Program Using Structs 3. 5.3. Method Syntax 13. 6. Enums and Pattern Matching 14. 1. 6.1. Defining an Enum 2. 6.2. The match Control Flow Construct 3. 6.3. Concise Control Flow with if let 15. 7. Managing Growing Projects with Packages, Crates, and Modules 16. 1. 7.1. Packages and Crates 2. 7.2. Defining Modules to Control Scope and Privacy 3. 7.3. Paths for Referring to an Item in the Module Tree 4. 7.4. Bringing Paths Into Scope with the use Keyword 5. 7.5. Separating Modules into Different Files 17. 8. Common Collections 18. 1. 8.1. Storing Lists of Values with Vectors 2. 8.2. Storing UTF-8 Encoded Text with Strings 3. 8.3. Storing Keys with Associated Values in Hash Maps 19. 9. Error Handling 20. 1. 9.1. Unrecoverable Errors with panic! 2. 9.2. Recoverable Errors with Result 3. 9.3. To panic! or Not to panic! 21. 10. Generic Types, Traits, and Lifetimes 22. 1. 10.1. Generic Data Types 2. 10.2. Traits: Defining Shared Behavior 3. 10.3. Validating References with Lifetimes 23. 11. Writing Automated Tests 24. 1. 11.1. How to Write Tests 2. 11.2. Controlling How Tests Are Run 3. 11.3. Test Organization 25. 12. An I/O Project: Building a Command Line Program 26. 1. 12.1. Accepting Command Line Arguments 2. 12.2. Reading a File 3. 12.3. Refactoring to Improve Modularity and Error Handling 4. 12.4. Developing the Library’s Functionality with Test Driven Development 5. 12.5. Working with Environment Variables 6. 12.6. Writing Error Messages to Standard Error Instead of Standard Output 27. 13. Functional Language Features: Iterators and Closures 28. 1. 13.1. Closures: Anonymous Functions that Capture Their Environment 2. 13.2. Processing a Series of Items with Iterators 3. 13.3. Improving Our I/O Project 4. 13.4. Comparing Performance: Loops vs. Iterators 29. 14. More about Cargo and Crates.io 30. 1. 14.1. Customizing Builds with Release Profiles 2. 14.2. Publishing a Crate to Crates.io 3. 14.3. Cargo Workspaces 4. 14.4. Installing Binaries from Crates.io with cargo install 5. 14.5. Extending Cargo with Custom Commands 31. 15. Smart Pointers 32. 1. 15.1. Using Box<T> to Point to Data on the Heap 2. 15.2. Treating Smart Pointers Like Regular References with the Deref Trait 3. 15.3. Running Code on Cleanup with the Drop Trait 4. 15.4. Rc<T>, the Reference Counted Smart Pointer 5. 15.5. RefCell<T> and the Interior Mutability Pattern 6. 15.6. Reference Cycles Can Leak Memory 33. 16. Fearless Concurrency 34. 1. 16.1. Using Threads to Run Code Simultaneously 2. 16.2. Using Message Passing to Transfer Data Between Threads 3. 16.3. Shared-State Concurrency 4. 16.4. Extensible Concurrency with the Sync and Send Traits 35. 17. Async and Await 36. 1. 17.1. Futures and the Async Syntax 2. 17.2. Concurrency With Async 3. 17.3. Working With Any Number of Futures 4. 17.4. Streams 5. 17.5. Digging Into the Traits for Async 6. 17.6. Futures, Tasks, and Threads 37. 18. Object Oriented Programming Features of Rust 38. 1. 18.1. Characteristics of Object-Oriented Languages 2. 18.2. Using Trait Objects That Allow for Values of Different Types 3. 18.3. Implementing an Object-Oriented Design Pattern 39. 19. Patterns and Matching 40. 1. 19.1. All the Places Patterns Can Be Used 2. 19.2. Refutability: Whether a Pattern Might Fail to Match 3. 19.3. Pattern Syntax 41. 20. Advanced Features 42. 1. 20.1. Unsafe Rust 2. 20.2. Advanced Traits 3. 20.3. Advanced Types 4. 20.4. Advanced Functions and Closures 5. 20.5. Macros 43. 21. Final Project: Building a Multithreaded Web Server 44. 1. 21.1. Building a Single-Threaded Web Server 2. 21.2. Turning Our Single-Threaded Server into a Multithreaded Server 3. 21.3. Graceful Shutdown and Cleanup 45. 22. Appendix 46. 1. 22.1. A - Keywords 2. 22.2. B - Operators and Symbols 3. 22.3. C - Derivable Traits 4. 22.4. D - Useful Development Tools 5. 22.5. E - Editions 6. 22.6. F - Translations of the Book 7. 22.7. G - How Rust is Made and “Nightly Rust” * Light * Rust * Coal * Navy * Ayu THE RUST PROGRAMMING LANGUAGE THE RUST PROGRAMMING LANGUAGE by Steve Klabnik, Carol Nichols, and Chris Krycho, with contributions from the Rust Community This version of the text assumes you’re using Rust 1.82.0 (released 2024-10-17) or later. See the “Installation” section of Chapter 1 to install or update Rust. The HTML format is available online at https://doc.rust-lang.org/stable/book/ and offline with installations of Rust made with rustup; run rustup doc --book to open. Several community translations are also available. This text is available in paperback and ebook format from No Starch Press. > 🚨 Want a more interactive learning experience? Try out a different version of > the Rust Book, featuring: quizzes, highlighting, visualizations, and more: > https://rust-book.cs.brown.edu