The Rust Programming Language, 2nd EditionNo Starch Press, 28 de fev. de 2023 - 560 páginas With over 50,000 copies sold, The Rust Programming Language is the quintessential guide to programming in Rust. Thoroughly updated to Rust’s latest version, this edition is considered the language’s official documentation. The Rust Programming Language "covers everything you could want to know about the language."—Stack Overflow Rust has been repeatedly voted "Most Loved Language" on the StackOverflow Developer Survey. The Rust Programming Language, 2nd Edition is the official guide to Rust 2021: an open source systems programming language that will help you write faster, more reliable software. Rust provides control of low-level details along with high-level ergonomics, allowing you to improve productivity and eliminate the hassle traditionally associated with low-level languages. Klabnik and Nichols, alumni of the Rust Core Team, share their knowledge to help you get the most out of Rust’s features so that you can create robust and scalable programs. You’ll begin with basics like creating functions, choosing data types, and binding variables, then move on to more advanced concepts, such as:
In addition to the countless code examples, you’ll find three chapters dedicated to building complete projects: a number-guessing game, a Rust implementation of a command line tool, and a multithreaded server. |
Conteúdo
Getting Started | 1 |
Hello Cargo | 7 |
Programming a Guessing Game | 13 |
Comparing the Guess to the Secret Number | 23 |
Summary | 30 |
Common Programming Concepts | 31 |
Data Types | 36 |
Functions | 43 |
Developing the Librarys Functionality with TestDriven Development | 259 |
Working with Environment Variables | 265 |
Summary | 272 |
Functional Language Features Iterators and Closures | 273 |
Processing a Series of Items with Iterators | 284 |
Loops vs Iterators | 293 |
More About Cargo and Crates io | 295 |
Smart Pointers | 315 |
Comments | 49 |
Summary | 58 |
Understanding Ownership | 59 |
References and Borrowing | 71 |
Using Structs to Structure Related Data | 85 |
An Example Program Using Structs | 91 |
Method Syntax | 97 |
Enums and Pattern Matching | 103 |
The match Control Flow Construct | 110 |
Concise Control Flow with if let | 116 |
Managing Growing Projects with Packages Crates and Modules | 119 |
Defining Modules to Control Scope and Privacy | 123 |
Bringing Paths into Scope with the use Keyword | 132 |
Summary | 140 |
Common Collections | 141 |
Storing UTF8 Encoded Text with Strings | 147 |
Summary | 159 |
Error Handling | 161 |
Recoverable Errors with Result | 165 |
To panic or Not to panic | 175 |
Generic Types Traits and Lifetimes | 181 |
Defining Shared Behavior | 192 |
Validating References with Lifetimes | 201 |
Generic Type Parameters Trait Bounds and Lifetimes Together | 213 |
Writing Automated Tests | 215 |
Test Organization | 236 |
Summary | 242 |
An IO Project Building a Command Line Program | 243 |
Refactoring to Improve Modularity and Error Handling | 248 |
Treating Smart Pointers Like Regular References with Deref | 321 |
Running Code on Cleanup with the Drop Trait | 327 |
RefCellT and the Interior Mutability Pattern | 334 |
Reference Cycles Can Leak Memory | 343 |
Summary | 351 |
Fearless Concurrency | 353 |
Using Message Passing to Transfer Data Between Threads | 361 |
SharedState Concurrency | 367 |
Extensible Concurrency with the Send and Sync Traits | 373 |
ObjectOriented Programming Features | 375 |
Using Trait Objects That Allow for Values of Different Types | 379 |
Summary | 396 |
Patterns and Matching | 397 |
Whether a Pattern Might Fail to Match | 403 |
Summary | 418 |
Advanced Features | 419 |
Advanced Traits | 430 |
Advanced Types | 440 |
Advanced Functions and Closures | 446 |
Macros | 449 |
Final Project Building a Multithreaded Web Server | 459 |
Turning Our SingleThreaded Server into a Multithreaded Server | 471 |
Graceful Shutdown and Cleanup | 487 |
Summary | 493 |
Keywords | 495 |
C | 507 |
Useful Development Tools | 511 |
Outras edições - Ver todos
Termos e frases comuns
&mut &str add_one add_to_waitlist annotations arguments assert_eq behavior borrow cargo run cargo test Cargo.toml Chapter closure code in Listing compile Config create debuginfo default defined Deref dereference operator enum environment variable error message example Finished dev unoptimized front_of_house function guess handle hash map Hello impl instance integer iterator keyword let mut lifetime parameter look loop macro main thread match expression method mock object module multiple mutable reference mutex newtype operator Option<T output ownership panic pattern println programming languages pub fn Rc<T Rectangle RefCell<T reference count result return value run cargo runtime Rust code Rust's scope shown in Listing signature smart pointers snip spawned thread specify src/lib.rs src/main.rs fn main standard library static variable string literal string slice struct syntax target(s ThreadPool trait bounds trait object tuple unsafe valid variant vector write

