وبلاگ بلیان

A Touch of Gold and Madness (Celestials of Arcadia Book 1)

معرفی کتاب «A Touch of Gold and Madness (Celestials of Arcadia Book 1)» نوشتهٔ K.L. DeVore، منتشرشده توسط نشر anonymous در سال 2023. این کتاب در فرمت epub، زبان انگلیسی ارائه شده است. «A Touch of Gold and Madness (Celestials of Arcadia Book 1)» در دستهٔ رمان خارجی قرار دارد.

Master professional-level coding in Rust. For developers who’ve mastered the basics, this book is the next step on your way to professional-level programming in Rust. It covers everything you need to build and maintain larger code bases, write powerful and flexible applications and libraries, and confidently expand the scope and complexity of your projects. Author Jon Gjengset takes you deep into the Rust programming language, dissecting core topics like ownership, traits, concurrency, and unsafe code. You’ll explore key concepts like type layout and trait coherence, delve into the inner workings of concurrent programming and asynchrony with async/await, and take a tour of the world of no_std programming. Gjengset also provides expert guidance on API design, testing strategies, and error handling, and will help develop your understanding of foreign function interfaces, object safety, procedural macros, and much more. You'll Learn: • How to design reliable, idiomatic, and ergonomic Rust programs based on best principles • Effective use of declarative and procedural macros, and the difference between them • How asynchrony works in Rust – all the way from the Pin and Waker types used in manual implementations of Futures, to how async/await saves you from thinking about most of those words • What it means for code to be unsafe, and best practices for writing and interacting with unsafe functions and traits • How to organize and configure more complex Rust projects so that they integrate nicely with the rest of the ecosystem • How to write Rust code that can interoperate with non-Rust libraries and systems, or run in constrained and embedded environments Brimming with practical, pragmatic insights that you can immediately apply, Rust for Rustaceans helps you do more with Rust, while also teaching you its underlying mechanisms. Brief Contents 9 Contents in Detail 11 Foreword 17 Preface 19 Acknowledgments 21 Introduction 23 What’s in the Book 24 Chapter 1: Foundations 27 Talking About Memory 28 Memory Terminology 28 Variables in Depth 29 Memory Regions 31 Ownership 33 Borrowing and Lifetimes 35 Shared References 35 Mutable References 36 Interior Mutability 38 Lifetimes 38 Summary 43 Chapter 2: Types 45 Types in Memory 45 Alignment 46 Layout 47 Complex Types 49 Dynamically Sized Types and Wide Pointers 49 Traits and Trait Bounds 50 Compilation and Dispatch 50 Generic Traits 54 Coherence and the Orphan Rule 54 Trait Bounds 57 Marker Traits 59 Existential Types 60 Summary 61 Chapter 3: Designing Interfaces 63 Unsurprising 64 Naming Practices 64 Common Traits for Types 65 Ergonomic Trait Implementations 66 Wrapper Types 66 Flexible 67 Generic Arguments 69 Object Safety 70 Borrowed vs. Owned 71 Fallible and Blocking Destructors 72 Obvious 73 Documentation 73 Type System Guidance 74 Constrained 76 Type Modifications 76 Trait Implementations 77 Hidden Contracts 79 Summary 82 Chapter 4: Error Handling 83 Representing Errors 84 Enumeration 84 Opaque Errors 85 Special Error Cases 87 Propagating Errors 88 Summary 91 Chapter 5: Project Structure 93 Features 93 Defining and Including Features 94 Using Features in Your Crate 96 Workspaces 96 Project Configuration 99 Crate Metadata 99 Build Configuration 99 Conditional Compilation 104 Versioning 106 Minimum Supported Rust Version 107 Minimal Dependency Versions 108 Changelogs 109 Unreleased Versions 109 Summary 110 Chapter 6: Testing 111 Rust Testing Mechanisms 112 The Test Harness 112 #[cfg(test)] 114 Doctests 116 Additional Testing Tools 118 Linting 118 Test Generation 119 Test Augmentation 122 Performance Testing 123 Summary 126 Chapter 7: Macros 127 Declarative Macros 128 When to Use Them 128 How They Work 130 How to Write Declarative Macros 132 Procedural Macros 135 Types of Procedural Macros 135 The Cost of Procedural Macros 136 So You Think You Want a Macro 137 How Do They Work? 139 Summary 141 Chapter 8: Asynchronous Programming 143 What’s the Deal with Asynchrony? 144 Synchronous Interfaces 144 Multithreading 145 Asynchronous Interfaces 146 Standardized Polling 147 Ergonomic Futures 147 async/await 150 Pin and Unpin 152 Going to Sleep 159 Waking Up 159 Fulfilling the Poll Contract 160 Waking Is a Misnomer 162 Tasks and Subexecutors 162 Tying It All Together with spawn 164 Summary 166 Chapter 9: Unsafe Code 167 The unsafe Keyword 168 Great Power 170 Juggling Raw Pointers 170 Calling Unsafe Functions 173 Implementing Unsafe Traits 177 Great Responsibility 179 What Can Go Wrong? 180 Validity 181 Panics 184 Casting 185 The Drop Check 186 Coping with Fear 189 Manage Unsafe Boundaries 189 Read and Write Documentation 190 Check Your Work 191 Summary 192 Chapter 10: Concurrency (and Parallelism) 193 The Trouble with Concurrency 194 Correctness 194 Performance 195 Concurrency Models 198 Shared Memory 198 Worker Pools 199 Actors 200 Asynchrony and Parallelism 201 Lower-Level Concurrency 203 Memory Operations 203 Atomic Types 204 Memory Ordering 204 Compare and Exchange 210 The Fetch Methods 213 Sane Concurrency 214 Start Simple 214 Write Stress Tests 215 Use Concurrency Testing Tools 215 Summary 218 Chapter 11: Foreign Function Interfaces 219 Crossing Boundaries with extern 220 Symbols 220 Calling Conventions 224 Types Across Language Boundaries 226 Type Matching 226 Allocations 228 Callbacks 230 Safety 230 bindgen and Build Scripts 233 Summary 235 Chapter 12: Rust Without the Standard Library 237 Opting Out of the Standard Library 238 Dynamic Memory Allocation 239 The Rust Runtime 241 The Panic Handler 241 Program Initialization 242 The Out-of-Memory Handler 242 Low-Level Memory Accesses 243 Misuse-Resistant Hardware Abstraction 245 Cross-Compilation 246 Summary 248 Chapter 13: The Rust Ecosystem 249 What’s Out There? 250 Tools 250 Libraries 251 Rust Tooling 254 The Standard Library 256 Patterns in the Wild 259 Index Pointers 259 Drop Guards 260 Extension Traits 262 Crate Preludes 262 Staying Up to Date 263 What Next? 264 Learn by Watching 265 Learn by Doing 266 Learn by Reading 267 Learn by Teaching 268 Summary 269 Index 271
دانلود کتاب A Touch of Gold and Madness (Celestials of Arcadia Book 1)