Idiomatic Rust: Code like a Rustacean

Β· Simon and Schuster
αžŸαŸ€αžœαž—αŸ…β€‹αž’αŸαž‘αž·αž…αžαŸ’αžšαžΌαž“αž·αž…
256
αž‘αŸ†αž–αŸαžš
αž˜αžΆαž“αžŸαž·αž‘αŸ’αž’αž·
αž€αžΆαžšαžœαžΆαž™αžαž˜αŸ’αž›αŸƒ αž“αž·αž„αž˜αžαž·αžœαžΆαž™αžαž˜αŸ’αž›αŸƒαž˜αž·αž“αžαŸ’αžšαžΌαžœαž”αžΆαž“αž•αŸ’αž‘αŸ€αž„αž•αŸ’αž‘αžΆαžαŸ‹αž‘αŸ αžŸαŸ’αžœαŸ‚αž„αž™αž›αŸ‹αž”αž“αŸ’αžαŸ‚αž˜

αž’αŸ†αž–αžΈαžŸαŸ€αžœαž—αŸ…β€‹αž’αŸαž‘αž·αž…αžαŸ’αžšαžΌαž“αž·αž€αž“αŸαŸ‡

Tips, tricks, design patterns, and secret features of Rust that will help you build stable and maintainable applications.

Whether you’re a Rust beginner or a pro, Idiomatic Rust will teach you to be a better Rust programmer. It introduces essential design patterns for Rust software with detailed explanations, and code samples that encourage you to get stuck in.

In Idiomatic Rust you’ll learn how to apply important design patterns including:

β€’ Fluent interfaces for creating delightful APIs
β€’ The Builder pattern to encapsulate data and perform initialization
β€’ Immutable data structures that help you avoid hard-to-debug data race conditions
β€’ Functional programming patterns
β€’ Anti-patterns and what not to do in Rust

Idiomatic Rust catalogs, documents, and describes both how classic design patterns work with Rust, and the new Rust-specific patterns that will help you master the language. Each pattern or best practice helps solve common programming problems and ensure your code is easy for others to understand. You’ll learn when to use each patternβ€”and when to break it! You’ll soon be producing higher-quality Rust code and higher-quality Rust software.

About the technology

After you’re comfortable with Rust’s syntax and its uniquely-powerful compiler, there’s a whole new dimension to explore as you put it to use in real projects. How do you apply standard design patterns in Rust applications? Where and why should you use IntoIterator? Why do Rustaceans love the PhantomData type? This book answers these questions and many, many more.

About the book

Idiomatic Rust introduces the coding and design patterns you’ll need to take advantage of Rust’s unique language design. This book’s clear explanations and reusable code examples help you explore metaprogramming, build your own libraries, create fluent interfaces, and more. Along the way, you’ll learn how to write efficient, idiomatic Rust code that’s easy to maintain and evolve as you learn how the language works under the hood.

What's inside

β€’ Creating delightful APIs
β€’ Applying Builder and other classic design patterns
β€’ Functional programming patterns
β€’ Rust anti-patterns

About the reader

For intermediate Rust programmers.

About the author

Brenden Matthews is a member of the Apache Software Foundation, creator of the system monitor Conky, and author of Code Like a Pro in Rust.

The technical editor on this book was Alain M Couniot.

Table of Contents

PART 1
1 Rust-y patterns
2 Rust’s basic building blocks
3 Code flow
PART 2
4 Introductory patterns
5 Design patterns: Beyond the basics
6 Designing a library
PART 3
7 Using traits, generics, and structs for specialized tasks
8 State machines, coroutines, macros, and preludes
PART 4
9 Immutability
10 Antipatterns
A Installing Rust

αž’αŸ†αž–αžΈβ€‹αž’αŸ’αž“αž€αž“αž·αž–αž“αŸ’αž’

Brenden Matthews is a software engineer, entrepreneur, and a prolific open source contributor. He has been using Rust since the early days of the language, and has contributed to a number of Rust tools and OS projects.

αžœαžΆαž™αžαž˜αŸ’αž›αŸƒαžŸαŸ€αžœαž—αŸ…β€‹αž’αŸαž‘αž·αž…αžαŸ’αžšαžΌαž“αž·αž€αž“αŸαŸ‡

αž”αŸ’αžšαžΆαž”αŸ‹αž™αžΎαž„αž’αŸ†αž–αžΈαž€αžΆαžšαž™αž›αŸ‹αžƒαžΎαž‰αžšαž”αžŸαŸ‹αž’αŸ’αž“αž€αŸ”

αž’αžΆαž“β€‹αž–αŸαžαŸŒαž˜αžΆαž“

αž‘αžΌαžšαžŸαž–αŸ’αž‘αž†αŸ’αž›αžΆαžαžœαŸƒ αž“αž·αž„β€‹αžαŸαž”αŸ’αž›αŸαž
αžŠαŸ†αž‘αžΎαž„αž€αž˜αŸ’αž˜αžœαž·αž’αžΈ Google Play Books αžŸαž˜αŸ’αžšαžΆαž”αŸ‹ Android αž“αž·αž„ iPad/iPhone αŸ” αžœαžΆβ€‹αž’αŸ’αžœαžΎαžŸαž˜αž€αžΆαž›αž€αž˜αŸ’αž˜β€‹αžŠαŸ„αž™αžŸαŸ’αžœαŸαž™αž”αŸ’αžšαžœαžαŸ’αžαž·αž‡αžΆαž˜αž½αž™β€‹αž‚αžŽαž“αžΈβ€‹αžšαž”αžŸαŸ‹αž’αŸ’αž“αž€β€‹ αž“αž·αž„β€‹αž’αž“αž»αž‰αŸ’αž‰αžΆαžαž±αŸ’αž™β€‹αž’αŸ’αž“αž€αž’αžΆαž“αž–αŸαž›β€‹αž˜αžΆαž“αž’αŸŠαžΈαž“αž’αžΊαžŽαž·αž αž¬αž‚αŸ’αž˜αžΆαž“β€‹αž’αŸŠαžΈαž“αž’αžΊαžŽαž·αžβ€‹αž“αŸ…αž‚αŸ’αžšαž”αŸ‹αž‘αžΈαž€αž“αŸ’αž›αŸ‚αž„αŸ”
αž€αž»αŸ†αž–αŸ’αž™αžΌαž‘αŸαžšβ€‹αž™αž½αžšαžŠαŸƒ αž“αž·αž„αž€αž»αŸ†αž–αŸ’αž™αžΌαž‘αŸαžš
αž’αŸ’αž“αž€αž’αžΆαž…αžŸαŸ’αžŠαžΆαž”αŸ‹αžŸαŸ€αžœαž—αŸ…αž‡αžΆαžŸαŸ†αž‘αŸαž„αžŠαŸ‚αž›αž”αžΆαž“αž‘αž·αž‰αž“αŸ…αž€αŸ’αž“αž»αž„ Google Play αžŠαŸ„αž™αž”αŸ’αžšαžΎαž€αž˜αŸ’αž˜αžœαž·αž’αžΈαžšαž»αž€αžšαž€αžαžΆαž˜αž’αŸŠαžΈαž“αž’αžΊαžŽαž·αžαž€αŸ’αž“αž»αž„αž€αž»αŸ†αž–αŸ’αž™αžΌαž‘αŸαžšαžšαž”αžŸαŸ‹αž’αŸ’αž“αž€αŸ”
eReaders αž“αž·αž„β€‹αž§αž”αž€αžšαžŽαŸβ€‹αž•αŸ’αžŸαŸαž„β€‹αž‘αŸ€αž
αžŠαžΎαž˜αŸ’αž”αžΈαž’αžΆαž“αž“αŸ…αž›αžΎβ€‹αž§αž”αž€αžšαžŽαŸ e-ink αžŠαžΌαž…αž‡αžΆβ€‹αž§αž”αž€αžšαžŽαŸαž’αžΆαž“β€‹αžŸαŸ€αžœαž—αŸ…αž’αŸαž‘αž·αž…αžαŸ’αžšαžΌαž“αž·αž€ Kobo αž’αŸ’αž“αž€αž“αžΉαž„αžαŸ’αžšαžΌαžœβ€‹αž‘αžΆαž‰αž™αž€β€‹αž―αž€αžŸαžΆαžš αž αžΎαž™β€‹αž•αŸ’αž‘αŸαžšαžœαžΆαž‘αŸ…β€‹αž§αž”αž€αžšαžŽαŸβ€‹αžšαž”αžŸαŸ‹αž’αŸ’αž“αž€αŸ” αžŸαžΌαž˜αž’αž“αž»αžœαžαŸ’αžαžαžΆαž˜β€‹αž€αžΆαžšαžŽαŸ‚αž“αžΆαŸ†αž›αž˜αŸ’αž’αž·αžαžšαž”αžŸαŸ‹αž˜αž‡αŸ’αžˆαž˜αžŽαŸ’αžŒαž›αž‡αŸ†αž“αž½αž™ αžŠαžΎαž˜αŸ’αž”αžΈαž•αŸ’αž‘αŸαžšαž―αž€αžŸαžΆαžšβ€‹αž‘αŸ…αž§αž”αž€αžšαžŽαŸαž’αžΆαž“αžŸαŸ€αžœαž—αŸ…β€‹αž’αŸαž‘αž·αž…αžαŸ’αžšαžΌαž“αž·αž€αžŠαŸ‚αž›αžŸαŸ’αž‚αžΆαž›αŸ‹αŸ”