Book description
Rust is a new systems programming language that combines the performance and low-level control of C and C++ with memory safety and thread safety. Rust’s modern, flexible types ensure your program is free of null pointer dereferences, double frees, dangling pointers, and similar bugs, all at compile time, without runtime overhead. In multi-threaded code, Rust catches data races at compile time, making concurrency much easier to use.
Written by two experienced systems programmers, this book explains how Rust manages to bridge the gap between performance and safety, and how you can take advantage of it. Topics include:
- How Rust represents values in memory (with diagrams)
- Complete explanations of ownership, moves, borrows, and lifetimes
- Cargo, rustdoc, unit tests, and how to publish your code on crates.io, Rust’s public package repository
- High-level features like generic code, closures, collections, and iterators that make Rust productive and flexible
- Concurrency in Rust: threads, mutexes, channels, and atomics, all much safer to use than in C or C++
- Unsafe code, and how to preserve the integrity of ordinary code that uses it
- Extended examples illustrating how pieces of the language fit together
Table of contents
- Preface
- 1. Why Rust?
- 2. A Tour of Rust
- 3. Basic Types
- 4. Ownership
- 5. References
-
6. Expressions
- An Expression Language
- Blocks and Semicolons
- Declarations
- if and match
- Loops
- return Expressions
- Why Rust Has loop
- Function and Method Calls
- Fields and Elements
- Reference Operators
- Arithmetic, Bitwise, Comparison, and Logical Operators
- Assignment
- Type Casts
- Closures
- Precedence and Associativity
- Onward
- 7. Error Handling
- 8. Crates and Modules
- 9. Structs
- 10. Enums and Patterns
- 11. Traits and Generics
- 12. Operator Overloading
- 13. Utility Traits
- 14. Closures
- 15. Iterators
- 16. Collections
-
17. Strings and Text
- Some Unicode Background
- Characters (char)
-
String and str
- Creating String Values
- Simple Inspection
- Appending and Inserting Text
- Removing Text
- Conventions for Searching and Iterating
- Patterns for Searching Text
- Searching and Replacing
- Iterating over Text
- Trimming
- Case Conversion for Strings
- Parsing Other Types from Strings
- Converting Other Types to Strings
- Borrowing as Other Text-Like Types
- Accessing Text as UTF-8
- Producing Text from UTF-8 Data
- Putting Off Allocation
- Strings as Generic Collections
- Formatting Values
- Regular Expressions
- Normalization
- 18. Input and Output
- 19. Concurrency
- 20. Macros
- 21. Unsafe Code
- Index
Product information
- Title: Programming Rust
- Author(s):
- Release date: December 2017
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781491927281
You might also like
book
40 Algorithms Every Programmer Should Know
Learn algorithms for solving classic computer science problems with this concise guide covering everything from fundamental …
book
Software Engineering at Google
Today, software engineers need to know not only how to program effectively but also how to …
book
Concurrency in Go
Concurrency can be notoriously difficult to get right, but fortunately, the Go open source programming language …
book
Data Science from Scratch, 2nd Edition
To really learn data science, you should not only master the tools—data science libraries, frameworks, modules, …

