目錄
Preface
1. Systems Programmers Can Have Nice Things
Rust Shoulders the Load for You
Parallel Programming Is Tamed
And Yet Rust Is Still Fast
Rust Makes Collaboration Easier
2. A Tour of Rust
rustup and Cargo
Rust Functions
Writing and Running Unit Tests
Handling Command-Line Arguments
Serving Pages to the Web
Concurrency
What the Mandelbrot Set Actually Is
Parsing Pair Command-Line Arguments
Mapping from Pixels to Complex Numbers
Plotting the Set
Writing Image Files
A Concurrent Mandelbrot Program
Running the Mandelbrot Plotter
Safety Is Invisible
Filesystems and Command-Line Tools
The Command-Line Interface
Reading and Writing Files
Find and Replace
3. Fundamental Types
Fixed-Width Numeric Types
Integer Types
Checked, Wrapping, Saturating, and Overflowing Arithmetic
Floating-Point Types
The bool Type
Characters
Tuples
Pointer Types
References
Boxes
Raw Pointers
Arrays, Vectors, and Slices
Arrays
Vectors
Slices
String Types
String Literals
Byte Strings
Strings in Memory
String
Using Strings
Other String-Like Types
Type Aliases
Beyond the Basics
4. Ownership and Moves
Ownership
Moves
More Operations That Move
Moves and Control Flow
Moves and Indexed Content
Copy Types: The Exception to Moves
Rc and Arc: Shared Ownership
5. References
References to Values
Working with References
Rust References Versus C++ References
Assigning References
References to References
Comparing References
……
6. Expressions
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
18. Input and Output
19. Concurrency
20. Asynchronous Programming
21. Macros
22. Unsafe Code
23. Foreign Functions
Index