Skip to product information
Programming Rust
Programming Rust
Description
Book Introduction
Covers more advanced features and is more user-friendly than the "Official Guide to Rust Programming"!

This book shows how Rust's features, which combine memory safety and reliable concurrency with predictable performance, give programmers greater control over memory consumption and processor usage.
Experienced systems programmers will find this practical guide helpful in learning how to successfully bridge the gap between performance and safety in Rust.
  • You can preview some of the book's contents.
    Preview

index
Translator's Preface xii
Beta Reader Review xvi
Starting with xix

CHAPTER 1: Systems Programmers, Take Flight with Tools You Won't Want to Miss

Safety 3: Reducing the Burden on Programmers
Parallel Programming 4: Doing What You Want
Still, a fast pace 4 you can't miss
5 Development Environments That Make Collaboration Easier

CHAPTER 2: A Tour of Rust 6

rustup and cargo 7
Rust Function 10
Write and run unit tests 12
Handling Command Line Arguments 13
Creating a Web Service 18
Simultaneity 24
Filesystem and Command-Line Tools 45

CHAPTER 3 Basic Types 54

Numeric type 57 with fixed size
bool type 67
Character 67
Tuple 69
Pointer type 71
Arrays, Vectors, and Slices 74
String type 81
Type alias 88
Going one step further 88

CHAPTER 4: Own and Move 89

Ownership 91
Move 96
Copy Type: Exception to Move 107
Rc and Arc: Shared Ownership 110

CHAPTER 5 REFERENCES 114

Reference to value 115
Handling References 119
Reference Safety 125
Shared vs.
Change 140
Facing the Sea of ​​Objects 148

CHAPTER 6 EXPRESSIONS 151

Expression Language 151
Priority and Associativity 153
Blocks and Semicolons 155
Declaration 157
if and match 159
if let 162
Loop 162
Control Flow in Loops 164
return expression 166
Why Rust Has Loops 167
Calling functions and methods 169
Fields and Elements 171
Reference Operator 173
Arithmetic, bitwise, comparison, and logical operators 173
Assignment 175
Type Casting 175
Clojure 177
Forward, Forward! 178

CHAPTER 7 Error Handling 179

Panic 179
Result 182

CHAPTER 8 CRATES AND MODULES 198

Crate 199
Module 204
Converting a Program to a Library 216
src/bin directory 218
Attribute 220
Testing and Documentation 223
Specifying Dependencies 233
Publishing a crate to crates.io 237
Workspace 239
More Cool Things 240

CHAPTER 9 Struct 242

Struct 243 with named fields
Tuple-type struct 246
Unit-type struct 247
Struct Layout 248
Defining Methods with Impl 249
Association constant 254
Generic Struct 255
Generic Struct 257 with Lifetime Parameters
Generic Structs with Constant Parameters 259
Implementing Common Traits in Struct Types 262
Internal variability 263

CHAPTER 10: Inium and Patterns 268

Inium 269
Pattern 280
Big Picture 295

CHAPTER 11: TRAITS AND GENERICS 297

Use of Traits 299
Definition and Implementation of Traits 311
Method call with all qualifiers 321
Trait 323, which defines relationships between types
Bound Reverse Engineering 332
Trait as a Foundation 336

CHAPTER 12 Operator Overloading 337

Arithmetic and bitwise operators 339
Equivalent comparison 345
Order comparison 349
Index and IndexMut 352
Other Operators 355

CHAPTER 13 UTILITY TRAITS 357

Drop 359
Size 362
Clone 366
Copy 367
Deref and DerefMut 368
Default 372
AsRef and AsMut 374
Borrow and BorrowMut 376
From and Into 378
TryFrom and TryInto 382
ToOwned 383
Borrow + ToOwned = Cow 384

CHAPTER 14 Closure 387

Capturing Variables 389
Function and Closure Types 392
Clojure Performance 395
Closures and Safety 396
Callback 403
Effective Closure Usage 408

CHAPTER 15 Iterators 411

Iterator and IntoIterator Traits 413
Creating an Iterator 415
Iterator Adapter 423
Consuming Iterators 443
Implementing Your Own Iterator 460

CHAPTER 16 COLLECTION 466

Browse 467
Vec〈T〉 468
VecDeque〈T〉 486
BinaryHeap〈T〉 489
HashMap〈KV〉 and BTreeMap〈KV〉 490
HashSet〈T〉 and BTreeSet〈T〉 498
Hashing 502
Using a Custom Hashing Algorithm 504
Going a step further than the standard collection 506

CHAPTER 17 Strings and Text 507

Some Background on Unicode 508
char 511
String and str 516
Formatting values ​​537
Regular expression 552
Normalization 555

CHAPTER 18 Input and Output 559

Leader and Writer 560
Files and Directories 577
Networking 587

CHAPTER 19: Concurrency 590

Fork-Join Parallel Processing 592
Channel 605
Shared state that can be changed 620
This is what it means to write concurrent code in Rust 638

CHAPTER 20 Asynchronous Programming 639

641 from synchronous to asynchronous
Asynchronous Client and Server 667
Built-in Futures and Executors: When Is It Good to Repolle Futures? 689
Pin setting 695
When is it appropriate to use asynchronous code? 703

CHAPTER 21 Macro 706

Macro Basics 708
Built-in macro 715
Macro Debugging 718
Creating a json! macro 719
Avoiding Syntax Errors During Matching 733
Going one step further with macro_rules! 734

CHAPTER 22 Unsafe Code 736

What is it that makes you unsafe? 737
Unsafe block 739
Example: Efficient ASCII string type 740
Unsafe function 743
Unsafe Blocks vs. Unsafe Functions 745
Undefined Action 746
Unsafe Trait 749
Raw Pointer 751
Reinterpreting Memory with Unions 774
Union Matching 777
Union Borrow 777

CHAPTER 23 External Functions 778

Finding Common Data Representations 779
Declaring External Functions and Variables 783
Using functions in the library 785
Raw interface to libgit2 790
libgit2's Secure Interface 797
Conclusion 810

Search 812

Detailed image
Detailed Image 1

Into the book
The translator, who likes to look at everything with a twisted perspective, had doubts throughout the process of translating this book into Korean, thinking, "If I'm careful, I might as well write safe code in C++." But each time, this one sentence written by the experienced author at the beginning of Chapter 1 of this book would come to mind.
“Saying that you can avoid undefined behavior in C and C++ is like saying that you can win a game of chess because you know the rules.” I couldn't argue with that.

--- p.xiv

The word "lazy" in that error message is not a pejorative, but rather our industry slang for any mechanism that postpones computation until the value is actually needed.
In Rust, it is customary for an iterator to do only the minimum amount of work necessary to satisfy each next call, but in the previous example, there is no next call at all, so nothing happens.

--- p.426

Of course, binary search only works if the slices are actually sorted in the specified order.
Otherwise, the results will be random.
It's like saying, "Where you plant beans, beans will grow, and where you plant red beans, red beans will grow" (garbage in, garbage out).

--- p.483

At first, writing concurrent code is easy and fun.
Tools like threads, locks, and queues are easy to choose and use without any hesitation.
It's true that there are many pitfalls, but fortunately, they are all well-known problems, so you just have to be careful not to make mistakes.
Then, as time goes by and you find yourself having to debug someone else's multi-threaded code, you half-voluntarily, half-involuntarily, come to the conclusion that you really shouldn't let everyone have these tools in their hands.
And when the time comes to debug your own multi-threaded code, you come to the same conclusion again.

--- p.590

We are familiar with the way &mut access is passed from parent to child, and from container to element.
So, for example, I think you can call the &mut self method on starships[id].engine only if you have a &mut reference to the starships you want to launch (of course, this also applies if you own the starships).
Congratulations, Elon Musk!).
Rust defaults to this familiar behavior, as there is no way to make a child have exclusive access to its parent unless it also has exclusive access to the parent.
--- p.626

Publisher's Review
A must-read following the "Official Guide to Rust Programming"!
Amazon's #1 Rust book!

Systems programming provides the foundation for the computing world.
Writing performance-sensitive code requires a programming language that gives programmers control over how memory, processor time, and other system resources are used.
The Rust systems programming language combines this control with a modern type system that catches a wide range of mistakes, from memory management errors to data races between threads.

This book shows how Rust's features, which combine memory safety and reliable concurrency with predictable performance, give programmers greater control over memory consumption and processor usage.
Experienced systems programmers will find this practical guide helpful in learning how to successfully bridge the gap between performance and safety in Rust.

ㆍ Rust's basic data types and the core concepts of ownership and borrowing
ㆍ How to write flexible and efficient code using traits and generics
How to write fast multi-threaded code without data contention
Rust's core tools: closures, iterators, and asynchronous programming
ㆍ Collections, strings and text, input and output, macros, unsafe code, external function interfaces
GOODS SPECIFICS
- Date of issue: January 16, 2023
- Page count, weight, size: 852 pages | 1,586g | 188*257*41mm
- ISBN13: 9791192469751
- ISBN10: 1192469755

You may also like

카테고리